date {
match => [ "timestamp","UNIX" ]
timezone => "%{timezone}"
target => "localtimestamp"
}
Timezone is "timezone" => "America/Vancouver"
I was expecting timestamp 1502844683 (GMT Wednesday, August 16, 2017 12:51:23 AM) to be converted to localtimestamp Wednesday, August 15, 2017 09:51:23 PM but I get this:
"localtimestamp" => 2017-08-16T00:51:23.000Z. --> appears to be GMT time
"@timestamp" => 2017-08-16T01:46:00.230Z. --> appears to be local UTC time
Unix timestamps (i.e. seconds since the epoch) are by definition always UTC and @timestamp is also always UTC. The timezone option indicates the timezone of the source timestamp, but doesn't really apply when the UNIX or UNIX_MS patterns are used.
I tried this unsuccessfully. Any chance you could guide me to a solution so that I can have a new field with a converted timestamp?
# "@timestamp": "2017-08-16T01:17:09.689Z"
mutate {
add_field => {
# Create a new field with string value of the UTC event date
"localtimestamp" => "%{@timestamp}"
}
}
date {
match => [ "localtimestamp","yyyy-MM-dd'T'HH:mm:ss", "ISO8601" ]
timezone => "%{timezone}"
target => "localtimestamp"
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.