fix: Add a check to prevent attempting to load a directory within patterns (#3326)

This commit is contained in:
Laurence Jones 2024-11-12 16:56:16 +00:00 committed by GitHub
parent 3ba71f412e
commit dd52e137ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,7 +43,7 @@ func Init(c map[string]interface{}) (*UnixParserCtx, error) {
}
r.DataFolder = c["data"].(string)
for _, f := range files {
if strings.Contains(f.Name(), ".") {
if strings.Contains(f.Name(), ".") || f.IsDir() {
continue
}
if err := r.Grok.AddFromFile(filepath.Join(c["patterns"].(string), f.Name())); err != nil {