我正在尝试转换" @ timestamp":" 2017-08-16T15:20:07.254Z"去美国/温哥华"时区。
这是输出: " LOCALTIMESTAMP" => " 2017-08-16 15:20:07.254", " localtimestamp1" => 2017-08-16T22:20:07.254Z,
mutate {
add_field => {
# Create a new field with string value of the UTC event date
"localtimestamp" => "%{@timestamp}"
}
}
ruby {
code => "
event.set('localtimestamp' , event.get('@timestamp').time.strftime('%Y-%m-%d %H:%M:%S.%L'))
"
}
date {
match => [ "localtimestamp", "yyyy-MM-dd HH:mm:ss.SSS" ]
timezone => "America/Vancouver"
target => "localtimestamp1"
}
任何帮助将不胜感激。我只需要在新字段中显示@timestamp,并将图章转换为本地时间