Hi team,
I am trying to send the log from filebeat to elasticsearch. The log format is
0 0 37096 1198332 0 5635848 0 0 0 0 346 332 0 0 100 0 0 2018-09-28 15:52:100
POST _ingest/pipeline/_simulate
{ "pipeline" :{
"description": "Pipeline for parsing vmstat system logs.",
"processors": [{
"grok": {
"field": "message",
"patterns":[
"%{SPACE}%{NUMBER:vmstat.system.r}\s+%{NUMBER:vmstat.system.b}\s+%{NUMBER:vmstat.system.swpd}\s+%{NUMBER:vmstat.system.free}\s+%{NUMBER:vmstat.system.buff}\s+%{NUMBER:vmstat.system.cache}\s+%{NUMBER:vmstat.system.si}\s+%{NUMBER:vmstat.system.so}\s+%{NUMBER:vmstat.system.bi}\s+%{NUMBER:vmstat.system.bo}\s+%{NUMBER:vmstat.system.in}\s+%{NUMBER:vmstat.system.cs}\s+%{NUMBER:vmstat.system.us}\s+%{NUMBER:vmstat.system.sy}\s+%{NUMBER:vmstat.system.id}\s+%{NUMBER:vmstat.system.wa}\s+%{NUMBER:vmstat.system.st}\s+%{DATETIMESTAMP:vmstat.system.dateandtime}"
],
"pattern_definitions": {
"DATETIMESTAMP": "%{YEAR}[/-]%{MONTHNUM}[/-]%{MONTHDAY} %{TIME}"
},
"ignore_missing": true
}
},{
"script" : {
"lang" : "painless",
"source" : "ctx.vmstat.system.cpuused=100-Integer.parseInt(ctx.vmstat.system.id);"
}
}
],
"on_failure" : [{
"set" : {
"field" : "error.message",
"value" : "{{ _ingest.on_failure_message }}"
}
}]
},
"docs":[
{
"_source": {
"message": " 0 0 37096 1198332 0 5635848 0 0 0 0 346 332 0 0 100 0 0 2018-09-28 15:52:10"
}
}
]
}
my parser works and it gives me the output as accepted only my timestamp value is not matching.
{
"docs": [
{
"doc": {
"_index": "_index",
"_type": "_type",
"_id": "_id",
"_source": {
"vmstat": {
"system": {
"st": "0",
"b": "0",
"cache": "5635848",
"in": "346",
"sy": "0",
"bi": "0",
"wa": "0",
"cpuused": 0,
"bo": "0",
"swpd": "37096",
"cs": "332",
"r": "0",
"si": "0",
"id": "100",
"so": "0",
"free": "1198332",
"dateandtime": "2018-09-28 15:52:10",
"buff": "0",
"us": "0"
}
},
"message": " 0 0 37096 1198332 0 5635848 0 0 0 0 346 332 0 0 100 0 0 2018-09-28 15:52:10"
},
"_ingest": {
"timestamp": "2018-10-04T09:50:57.290Z"
}
}
}
]
}
is their any way to match timestamp and dateandtime variable. so that while selecting index in kibana,
i could search based on timestamp.