parsing dates with variable spaces

前端 未结 3 967
你的背包
你的背包 2020-12-06 12:13

I am using Joda to parse dates and have a format where leading zeros are not used, e.g.:

 Mon Nov 20 14:40:36 2006
 Mon Nov  6 14:40:36 2006
<
3条回答
  •  借酒劲吻你
    2020-12-06 12:39

    I tried using a single 'd' as suggested above in logstash 1.1.1 but it still complained about a malformed date when a single digit day with an extra leading space was parsed. The following logstash rules did work.

    timestamp => [ "MMM dd HH:mm:ss", "MMM  d HH:mm:ss" ]
    

    It didn't matter which order the two date formats were in. No more warnings were output once I added both formats.

提交回复
热议问题