Hello all, as part of testing Elasticsearch for use within our organisation I'm trying to capture entries from the Windowsupdate.log file in C:\Windows but I'm having trouble converting the log's timestamp to be the Elasticsearch @timestamp.
I created a filter to add the date to a custom field called 'timestamp' - my logstash.conf below:
filter {
if [type] == "winupdatelog" {
grok {
match => { "message" => "(?<timestamp>%{YEAR}-%{MONTHNUM}-%{MONTHDAY}\t%{HOUR}:?%{MINUTE}(?::?%{SECOND}))\t%{GREEDYDATA:PID}\t%{GREEDYDATA:TID}\t%{GREEDYDATA:component}\t%{GREEDYDATA:message} "
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{@source_host}" ]
}
date {
match => [ "timestamp","yyyy-MM-dd HH:mm:ss,SSS" ]
}
However it doesn't seem to be working; when I view the documents in Kibana they all have the date they were received rather than the one in the actual log. Below is the JSON output for one of the documents:
{
"_index": "filebeat-2017",
"_type": "winupdatelog",
"_id": "AVrkOHzT3xn1BxItwBNG",
"_score": null,
"_source": {
"offset": 229679,
"input_type": "log",
"PID": " 976",
"source": "C:\\Windows\\Windowsupdate.log",
"message": [
"2017-03-03\t20:36:04:398\t 976\t1930\tMisc\tValidating signature for C:\\Windows\\SoftwareDistribution\\WuRedir\\7971F918-A847-4430-9279-4A52D1EFE18D\\TMP87F9.tmp with dwProvFlags 0x00000080:",
"Validating signature for C:\\Windows\\SoftwareDistribution\\WuRedir\\7971F918-A847-4430-9279-4A52D1EFE18D\\TMP87F9.tmp with dwProvFlags"
],
"type": "winupdatelog",
"TID": "1930",
"tags": [
"beats_input_codec_plain_applied",
"_dateparsefailure"
],
"component": "Misc",
"received_from": "%{@source_host}",
"@timestamp": "2017-03-19T01:39:44.955Z",
"received_at": "2017-03-19T01:39:44.955Z",
"@version": "1",
"beat": {
"hostname": "LAPTOP01",
"name": "LAPTOP01",
"version": "5.2.2"
},
"host": "LAPTOP01",
"timestamp": "2017-03-03\t20:36:04:398"
},
"fields": {
"@timestamp": [
1489887584955
]
},
"sort": [
1489887584955
]
}
Can anyone tell me where I'm going wrong?
Thanks.