0
以下格式我得到@timestamp我logstash滤波器提取工作日以文本格式从时间戳logstash
"@timestamp" => "2016-11-28T19:19:05.627Z"
我希望通过添加一个新的领域为一周来提取文本格式工作日和月值和月份。我的输出应该像
week-day:monday
month:nov
我使用Ruby代码
ruby {
code => '
require "time"
event["week-day"] = event["@timestamp"].strftime "%a"
'
}
,但得到的错误
Ruby exception occurred: undefined method `strftime' for "2016-11-28T19:19:05.804Z":LogStash::Timestamp {:level=>:error}
,有没有办法在神交或相同的Ruby代码做的一样吗?
任何帮助将不胜感激!
是啊,我不是那个转换时间。它的工作..谢谢@Val – sabya
很高兴帮助! – Val