当前位置:网站首页>The ruby code in logstash converts the @timestamp timestamp format

The ruby code in logstash converts the @timestamp timestamp format

2022-06-22 09:47:00 zhangphil

logstash in ruby Code handle @timestamp Timestamp format conversion

filter{
ruby {
		code => "event.set('xxx_time',(event.get('@timestamp').time.localtime).strftime('%Y-%m-%d %H:%M:%S'))
				"
 	}
}

xxx_time That is, the customized time field in the configuration . The above code will logstash Automatically generated timestamp @timestamp Convert to 2022-01-01 00:00:59, Form like this , Save to xxx_time Inside .

原网站

版权声明
本文为[zhangphil]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220934230790.html