简体   繁体   English

自纪元以来的Logstash日期解析失败,以毫秒为单位

[英]Logstash date parse failure with milliseconds since epoch

Logstash is not able to parse milliseconds since epoch and returns me an parse failure. 自epoch以来,Logstash无法解析毫秒,并向我返回解析失败。 There are no whitspaces in the content of the timestamo field in the xml and logstash selects the right value. xml中的timestamo字段的内容中没有任何空格,logstash选择正确的值。

filter {
    xml {
            source => "message"
            remove_namespaces => true
            store_xml => false
            xpath => ["//event/@timestamp", "@time_since_epoch"]
    }

    date {
            match => [ "@time_since_epoch","UNIX_MS" ]
            target => "@time"
    }
}

What I am doing wrong? 我做错了什么?

EDIT 编辑

sample xml data line: 样本xml数据行:

<event timestamp="1494599590213" ><message>Dummy message</message></event>

Apparently the value extracted from the xpath is put in an array (see: "@time_since_epoch":["1494599590213"] with the stdout plugin and the json codec). 显然,从xpath提取的值放在一个数组中(请参阅: "@time_since_epoch":["1494599590213"]带有stdout插件和json编解码器)。

So you'll need to access the time as an array element: 因此,您需要将时间作为数组元素进行访问:

date {
        match => [ "[@time_since_epoch][0]","UNIX_MS" ]
        target => "@time"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是Date.now()以毫秒为单位的本地毫秒数,还是UTC时间以秒为单位的毫秒数 - Is Date.now() in local milliseconds since epoch, or milliseconds since epoch in UTC time 将日期字符串“yyyy-mm-dd”转换为自纪元以来的毫秒数 - Convert a date string “yyyy-mm-dd” to milliseconds since epoch 使用时间间隔(以毫秒为单位)比较javascript中的日期和时间 - Compare date and time in javascript using time in milliseconds since epoch JAVA 从 ISO_DATE_TIME 获取自纪元以来的毫秒数 - JAVA Get Milliseconds since Epoch from ISO_DATE_TIME 有没有办法以mongodb聚合管道中的epoch(Date.getTime())之后的毫秒访问日期 - Is there a way to access a Date as milliseconds since epoch (Date.getTime()) in mongodb aggregation pipeline 如何在epoch值以后的毫秒内设置mysql更新中的日期? - How do you set a date in a mysql update from a milliseconds since epoch value? 自加载Unix纪元以来,将mongo存储日期转换回毫秒数? - Converting a mongo stored date back into milliseconds since Unix epoch when loaded? 将纪元时间(以毫秒为单位)添加到纪元日期/时间? - Add epoch time with milliseconds to a epoch date/time? 转换自纪元至今的天数 - Converting days since epoch to date 将时间/日期转换为纪元(自 1970 年以来的秒数) - Convert time/date to epoch (seconds since 1970)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM