Hi Elastic users,
I'm forwarding logs from host to an ELK's logstash instance via filebeat. I'm using @timestamp as the time for the index pattern for my logs. The original @timestamp from filebeat while processing the log line. I'd like to user the rsyslog timestamp as the index pattern time but still using @timetamp filed. I think I need to overwrite the @timestamp with rsyslog.timestamp. The filebeat dissect extract the ISO8601 timestamp 2020-06-16T14:13:29.808106+00:00
as rsyslog.timestamp field and send to logstash.
2020-06-16T14:13:29.808106+00:00 hostname proxy-server: info 192.150.13.21 192.150.13.201 16/Jun/2020/14/13/29 HEAD /v1/AUTH_test/con/obj HTTP/1.0 204 - checkworker passtoken - - - tx111e7cf6ce7f4b499cef0-005ee8d123 - 0.0557 - - 1592316809.731336117 1592316809.787007093 0 -
I found some discussion around and modified the example to mine as below.
filter {
if [type] == "beats" {
grok {
match => { "rsyslog.timestamp" => "%{TIMESTAMP_ISO8601:ts}" }
}
date {
match => ["ts", "ISO8601"]
target => "@timestamp"
#remove_field => [ "ts", "timestamp" ]
}
}
However, the result is still using the log ingesting time as the timestamp.
{
"_index": "logstash-filebeats-2020.06.16",
"_type": "doc",
"_id": "8_eCvXIB6flSpCLHFqih",
"_version": 1,
"_score": null,
"_source": {
"content_length": "-",
"message": "2020-06-16T09:20:44.936764+00:00 hostname container-server: info 192.150.23.3 - - [16/Jun/2020:09:20:44 +0000] \"DELETE /d157/3806/.shards_AUTH_acc/test-data/obj\" 204 - \"DELETE http://abc.net\" \"object-server 305346\" 0.0008 \"-\" 25892 0",
"status_int": "204",
"rsyslog": {
"timestamp": "2020-06-16T09:20:44.936764+00:00",
"hostname": "ss0137"
},
"@timestamp": "2020-06-16T14:21:57.793Z",
"additional_info": "-",
"tags": [
"beats_input_codec_plain_applied",
"_grokparsefailure"
],
"log": {
"file": {}
},
"user_agent": "object-server 305346",
"request_method": "DELETE"
},
"fields": {
"@timestamp": [
"2020-06-16T14:21:57.793Z"
],
"rsyslog.timestamp": [
"2020-06-16T09:20:44.936Z"
]
},
"sort": [
1592317317793
]
}
May I have some idea how to replcae the timestamp with rsyslog.timestamp field?
- ELK 6.6
- Filebeat 7.7
Thanks // Hugo