作者:jkjkjd_105 | 来源:互联网 | 2023-05-16 19:57
logstash的配置文件添加filter{ruby{code>event.set(timestamp,event.get(@timestamp).time.
logstash 的配置文件添加
filter {
ruby {
code => "event.set('timestamp', event.get('@timestamp').time.localtime + 8*60*60)"
}
ruby {
code => "event.set('@timestamp',event.get('timestamp'))"
}
mutate {
remove_field => ["timestamp"]
}
}
这样output 输出的时间才是正确的,前提服务器时区已经修改了
output:
file{
path => "/data/logs/service/stdout-%{+YYYY-MM-dd-HH}.log"
codec => line {
format => "%{message}"
}
}