Convert timestamp timezone in Logstash for output index name

后端 未结 4 1417
一个人的身影
一个人的身影 2021-01-01 02:47

In my scenario, the \"timestamp\" of the syslog lines Logstash receives is in UTC and we use the event \"timestamp\" in the Elasticsearch output:

output {
           


        
4条回答
  •  既然无缘
    2021-01-01 03:26

    In logstash version 5.0 and later, you can use this:

    filter{
    ruby {
            code => "event.set('index_day', event.get('[@timestamp]').time.localtime.strftime('%Y%m%d'))"
        }
    }
    

提交回复
热议问题