mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
replace imports of path with path/filepath (#2330)
This commit is contained in:
parent
1a6f12c88e
commit
a01ce18b98
7 changed files with 19 additions and 21 deletions
|
@ -3,7 +3,7 @@ package parser
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
@ -46,7 +46,7 @@ func Init(c map[string]interface{}) (*UnixParserCtx, error) {
|
|||
if strings.Contains(f.Name(), ".") {
|
||||
continue
|
||||
}
|
||||
if err := r.Grok.AddFromFile(path.Join(c["patterns"].(string), f.Name())); err != nil {
|
||||
if err := r.Grok.AddFromFile(filepath.Join(c["patterns"].(string), f.Name())); err != nil {
|
||||
log.Errorf("failed to load pattern %s : %v", f.Name(), err)
|
||||
return nil, err
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ func NewParsers() *Parsers {
|
|||
func LoadParsers(cConfig *csconfig.Config, parsers *Parsers) (*Parsers, error) {
|
||||
var err error
|
||||
|
||||
patternsDir := path.Join(cConfig.Crowdsec.ConfigDir, "patterns/")
|
||||
patternsDir := filepath.Join(cConfig.Crowdsec.ConfigDir, "patterns/")
|
||||
log.Infof("Loading grok library %s", patternsDir)
|
||||
/* load base regexps for two grok parsers */
|
||||
parsers.Ctx, err = Init(map[string]interface{}{"patterns": patternsDir,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue