Added decoder_msg_type field to logs parsed by syslog
This commit is contained in:
parent
3ded2fcd2d
commit
74634a6bf0
2 changed files with 38 additions and 29 deletions
|
|
@ -57,6 +57,9 @@ func FieldsFromSyslog(line string) (map[string]interface{}, error) {
|
||||||
out[newKey] = v
|
out[newKey] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out["decoder_msg_type"] = "syslog"
|
||||||
|
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ func TestSyslogDecoding(t *testing.T) {
|
||||||
"hostname": "some-host",
|
"hostname": "some-host",
|
||||||
"programname": "docker/fa3a5e338a47",
|
"programname": "docker/fa3a5e338a47",
|
||||||
"rawlog": "log body",
|
"rawlog": "log body",
|
||||||
|
"decoder_msg_type": "syslog",
|
||||||
},
|
},
|
||||||
ExpectedError: nil,
|
ExpectedError: nil,
|
||||||
},
|
},
|
||||||
|
|
@ -142,6 +143,7 @@ func TestSyslogDecoding(t *testing.T) {
|
||||||
"hostname": "influx-service",
|
"hostname": "influx-service",
|
||||||
"programname": "docker/0000aa112233",
|
"programname": "docker/0000aa112233",
|
||||||
"rawlog": "[httpd] 2017/04/05 21:45:54 172.17.42.1 - heka [05/Apr/2017:21:45:54 +0000] POST /write?db=foo&precision=ms HTTP/1.1 204 0 - Go 1.1 package http 123456-1234-1234-b11b-000000000000 13.688672ms",
|
"rawlog": "[httpd] 2017/04/05 21:45:54 172.17.42.1 - heka [05/Apr/2017:21:45:54 +0000] POST /write?db=foo&precision=ms HTTP/1.1 204 0 - Go 1.1 package http 123456-1234-1234-b11b-000000000000 13.688672ms",
|
||||||
|
"decoder_msg_type": "syslog",
|
||||||
},
|
},
|
||||||
ExpectedError: nil,
|
ExpectedError: nil,
|
||||||
},
|
},
|
||||||
|
|
@ -153,6 +155,7 @@ func TestSyslogDecoding(t *testing.T) {
|
||||||
"hostname": "mongodb-some-machine",
|
"hostname": "mongodb-some-machine",
|
||||||
"programname": "whackanop",
|
"programname": "whackanop",
|
||||||
"rawlog": "2017/04/05 21:46:11 found 0 ops",
|
"rawlog": "2017/04/05 21:46:11 found 0 ops",
|
||||||
|
"decoder_msg_type": "syslog",
|
||||||
},
|
},
|
||||||
ExpectedError: nil,
|
ExpectedError: nil,
|
||||||
},
|
},
|
||||||
|
|
@ -164,6 +167,7 @@ func TestSyslogDecoding(t *testing.T) {
|
||||||
"hostname": "ip-10-0-0-0",
|
"hostname": "ip-10-0-0-0",
|
||||||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||||
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished"}`,
|
"rawlog": `2017/04/05 21:57:46 some_file.go:10: {"title":"request_finished"}`,
|
||||||
|
"decoder_msg_type": "syslog",
|
||||||
},
|
},
|
||||||
ExpectedError: nil,
|
ExpectedError: nil,
|
||||||
},
|
},
|
||||||
|
|
@ -258,6 +262,7 @@ func TestParseAndEnhance(t *testing.T) {
|
||||||
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
"programname": `env--app/arn%3Aaws%3Aecs%3Aus-west-1%3A999988887777%3Atask%2Fabcd1234-1a3b-1a3b-1234-d76552f4b7ef`,
|
||||||
"rawlog": `some log`,
|
"rawlog": `some log`,
|
||||||
"env": "deploy-env",
|
"env": "deploy-env",
|
||||||
|
"decoder_msg_type": "syslog",
|
||||||
"container_env": "env",
|
"container_env": "env",
|
||||||
"container_app": "app",
|
"container_app": "app",
|
||||||
"container_task": "abcd1234-1a3b-1a3b-1234-d76552f4b7ef",
|
"container_task": "abcd1234-1a3b-1a3b-1234-d76552f4b7ef",
|
||||||
|
|
@ -297,6 +302,7 @@ func TestParseAndEnhance(t *testing.T) {
|
||||||
"env": "deploy-env",
|
"env": "deploy-env",
|
||||||
"hostname": "mongo-docker-pipeline-r10-4",
|
"hostname": "mongo-docker-pipeline-r10-4",
|
||||||
"programname": "diamond",
|
"programname": "diamond",
|
||||||
|
"decoder_msg_type": "syslog",
|
||||||
"rawlog": "Signal Received: 15",
|
"rawlog": "Signal Received: 15",
|
||||||
"timestamp": logTime2,
|
"timestamp": logTime2,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue