Add path tag to logparser containing path of logfile (#3098)
This commit is contained in:
@@ -69,7 +69,10 @@ func TestGrokParseLogFiles(t *testing.T) {
|
||||
"response_time": int64(5432),
|
||||
"myint": int64(101),
|
||||
},
|
||||
map[string]string{"response_code": "200"})
|
||||
map[string]string{
|
||||
"response_code": "200",
|
||||
"path": thisdir + "grok/testdata/test_a.log",
|
||||
})
|
||||
|
||||
acc.AssertContainsTaggedFields(t, "logparser_grok",
|
||||
map[string]interface{}{
|
||||
@@ -77,7 +80,9 @@ func TestGrokParseLogFiles(t *testing.T) {
|
||||
"mystring": "mystring",
|
||||
"nomodifier": "nomodifier",
|
||||
},
|
||||
map[string]string{})
|
||||
map[string]string{
|
||||
"path": thisdir + "grok/testdata/test_b.log",
|
||||
})
|
||||
}
|
||||
|
||||
func TestGrokParseLogFilesAppearLater(t *testing.T) {
|
||||
@@ -115,7 +120,10 @@ func TestGrokParseLogFilesAppearLater(t *testing.T) {
|
||||
"response_time": int64(5432),
|
||||
"myint": int64(101),
|
||||
},
|
||||
map[string]string{"response_code": "200"})
|
||||
map[string]string{
|
||||
"response_code": "200",
|
||||
"path": emptydir + "/test_a.log",
|
||||
})
|
||||
}
|
||||
|
||||
// Test that test_a.log line gets parsed even though we don't have the correct
|
||||
@@ -148,7 +156,10 @@ func TestGrokParseLogFilesOneBad(t *testing.T) {
|
||||
"response_time": int64(5432),
|
||||
"myint": int64(101),
|
||||
},
|
||||
map[string]string{"response_code": "200"})
|
||||
map[string]string{
|
||||
"response_code": "200",
|
||||
"path": thisdir + "grok/testdata/test_a.log",
|
||||
})
|
||||
}
|
||||
|
||||
func getCurrentDir() string {
|
||||
|
||||
Reference in New Issue
Block a user