I have my log something like this :
May 23 2018 06:32:47 GMT: INFO (xdr): (xdr.c:607) [030]: dc-state CLUSTER_UP timelag-sec 0 lst 1527057166864 mlst 1527057166864 (2018-05-23 06:32:46 GMT) fnlst 0 (-) wslst 0 (-) shlat-ms 1 rsas-ms 0.000 rsas-pct 0.0 con 384 errcl 502 errsrv 1182 sz 6
i parsed it using grok filter and i have something called list_field value.
list_field_value = dc-state CLUSTER_UP timelag-sec 0 lst 1527057166864 mlst 1527057166864 (2018-05-23 06:32:46 GMT) fnlst 0 (-) wslst 0 (-) shlat-ms 1 rsas-ms 0.000 rsas-pct 0.0 con 384 errcl 502 errsrv 1182 sz 6
it is a combination of field and value.
here dc-state is a field and CLUSTER-UP is its respective value and so on.
now i am using KV filter in logstash to split list_field_value into a key value pair.
now i want to ignore two types of values while spiltting : one is (2018-05-23 06:32:46 GMT) like timstasmp and other is (-).
my code is :
grok {
patterns_dir => ["/etc/logstash/patterns"]
match => { "message" => "%{TIMESTAMP_LOG:time}: %{LOGLEVEL:loglevel} \(%{WORD:module}\): \(%{FILENAME:file_name}:%{NUMBER:file_no}\) ((\{%{NAMESPACE:namespace}\}|\s*%{CATEGORY:category}:|\s*%{CUSTOM_VALUE_LIST_COMPLEX:list_field_value}|\s*%{FIELD:field}\s*)+)"}
}
kv{
source => "list_field_value"
target => "kvpairs"
value_split => " "
}
i tried splitting on the basis of " " but then these two fields are also coming and timestamp is breaking and getting split and some part of it is coming as key and some part in value. because of this the other key value pair are getting affected
output is :
{
"module" => "xdr",
"@version" => "1",
"file_num" => "607",
"kvpairs" => {
"mlst" => "1527057166864",
"0.000" => "rsas-pct",
"502" => "errsrv",
"timelag-sec" => "0",
"(2018-05-23" => "06:32:46",
"1182" => "sz",
"dc-state" => "CLUSTER_UP",
"GMT)" => "fnlst",
"1" => "rsas-ms",
"wslst" => "0",
"0" => "-",
"384" => "errcl",
"(-)" => "shlat-ms",
"0.0" => "con",
"lst" => "1527057166864"
},
"path" => "/home/shivi/Desktop/c.log",
"file_name" => "xdr.c",
"time" => "May 23 2018 06:32:47 GMT",
"before" => "May 23 2018 06:32:47 GMT: INFO (xdr):",
"list_field_value" => "dc-state CLUSTER_UP timelag-sec 0 lst 1527057166864 mlst 1527057166864 (2018-05-23 06:32:46 GMT) fnlst 0 (-) wslst 0 (-) shlat-ms 1 rsas-ms 0.000 rsas-pct 0.0 con 384 errcl 502 errsrv 1182 sz 6",
"host" => "shivi-Inspiron-5558",
"message" => "May 23 2018 06:32:47 GMT: INFO (xdr): (xdr.c:607) [030]: dc-state CLUSTER_UP timelag-sec 0 lst 1527057166864 mlst 1527057166864 (2018-05-23 06:32:46 GMT) fnlst 0 (-) wslst 0 (-) shlat-ms 1 rsas-ms 0.000 rsas-pct 0.0 con 384 errcl 502 errsrv 1182 sz 6",
"@timestamp" => 2018-06-06T07:06:11.223Z,
"filename" => "xdr.c",
"loglevel" => "INFO",
"category" => "[030]",
"file_no" => "607"
}
can somone plese tell me how to ignore these certain values and keys in kvpairs ?
any help is appreciated.