We have input data that is space-delimited and I created a filter to parse it. All fields get populated as I need, except if there I have a 6-character field that contains a numeric value that takes up less than 6 characters. I need to graph these values over time but the leading white spaces are causing NagiosLog to throw an error about an incorrect data type.
Example- the APTIME and the BKTIME fields have only 53 and 389 respectively, but the actual field width as specified is 6, per the filter:
Code: Select all
(?<APTIME>.{6}) (?<BKTIME>.{6})
Code: Select all
if [type] == 'appv2' {
mutate {
gsub => ["message", "[\u0000]", ""]
}
grok {
match => [ "message", "[\u0000]", "%{TIMESTAMP_ISO8601:logdate} (?<MDNIT>.{8}) (?<V>.{1}) (?<TRANCODE>.{12}) (?<FIELD1>.{2}) (?<FIELD2>.{2}) (?<FIELD3>.{2}) (?<FIELD4>.{6}) (?<PROCESS>.{6}) (?<APTIME>.{6}) (?<BKTIME>.{6}) (?<FIELD5>.{6}) (?<CODES>.{8}) (?<FIELD6>.{2}) (?<MC>.{2}) (?<PV>.{2}) (?<PC>.{2}) (?<PX>.{2}) (?<SYS>.{5}) (?<CT>.{2}) (?<RESULTS>.{9}) (?<FIELD7>.{13})"]
}
mutate {
strip => [
"MDNIT",
"APTIME",
"PROCESS",
"BKTIME",
"FIELD5",
"CODES"
"FIELD7"
"RESULTS"
]
}
date {
match => [ "logdate", "YYYY-MM-dd HH:mm:ss.SSS" ]
}
}
Code: Select all
{"message": "2016-09-05 15:23:44.617 55424617 1 TRS123456789 XX YY 21 345678 919 128 118 544 ZZ 2 N P 1 APPLC 21 NNNNNNNNN KKKKKKKKKKKKk\n"}