2014-10-06 119 views
1

我正在使用logstash来跟踪我的日志。 我使用文件作为输入和elasticsearch作为输出。 我的配置文件看起来像这样:Logstash替换@timestamp

input{ 
    file{ 
    path => "C:\products.logs" 
    format => "json" 
    } 
} 
filter{ 
} 
output{ 
    elasticsearch{ 
    host => localhost 
    } 
} 

文件充满了原木的线路和每个日志看起来是这样的:

{"ID":65464,"Name":"Tracker_56213453.xml","sender_sent_time":"10/04/2014 14:14:40","insertion_time":"10/04/2014 14:14:40","Is_Valid":true} 

,你可以看到,有更多的则是1个值保存时间格式。 当我试图添加此日期过滤器:

filter{ 
     date{ 
     match=>["insertion_time","dd/MM/YYYY HH:mm:ss"] 
     } 
    } 

,但没有奏效。 我做错了什么? 谢谢。

+0

您的日期不会DD/MM/YYYY ... – 2014-10-06 13:59:45

回答

0

日期的默认target@timestamp。如果你想在地方转换,你要添加target => insertion_time

0

你的过滤器应该如下所示:

filter{ 
    date{ 
    match=>["insertion_time","dd/MM/YYYY HH:mm:ss"] 
    locale => "en" 
    timezone => "UTC" 
    target => ["insertion_time"] 
    } 
} 
0

使用本:

filter { 
    # match date and time 
    date { 
     "match" => ["insertion_time", "dd/MM/YYYY HH:mm:ss"] 
     "target" => "insertion_time" 
    } 
} 
相关问题