【发布时间】:2016-10-30 08:02:39
【问题描述】:
所以我有以下格式的日志消息:
[INFO] <blah.blah> 2016-06-27 21:41:38,263 some text
[INFO] <blah.blah> 2016-06-28 18:41:38,262 some other text
现在我想删除所有不包含特定字符串“xyz”的日志并保留所有其余的。我也想索引时间戳。
grokdebug 没有多大帮助。
这是我的尝试:
input {
file {
path => "/Users/username/Desktop/validateLogconf/logs/*"
start_position => "beginning"
}
}
filter {
grok {
match => {
"message" => '%{SYSLOG5424SD:loglevel} <%{JAVACLASS:job}> %{GREEDYDATA:content}'
}
}
date {
match => [ "Date", "YYYY-mm-dd HH:mm:ss" ]
locale => en
}
}
output {
stdout {
codec => plain {
charset => "ISO-8859-1"
}
}
elasticsearch {
hosts => "http://localhost:9201"
index => "hello"
}
}
我是新来的,所以上面的模式可能没有意义。请帮忙。
【问题讨论】:
-
你应该问两个问题而不是一个问题。
标签: elasticsearch logstash logstash-configuration