问题描述
我的日志文件在几行中包含不同的结构,我无法理解它,我不知道我们是否可以按行或属性进行测试,我仍然是一个初学者.如果您不了解我,我可以举几个例子:
My log file contains different structures in a few lines, and I can not grok it, I don't know if we can test by lines or attribute, I'm still a beginner.if you don't understand me I can give you some examples :
输入:
id=firewall action=bloc type=web
id=firewall fw="ER" type=filter
id=firewall fw="Az" tz="loo" action=bloc
模式:
id=%{WORD:id} ...
我想在()之间添加一些模式?,但我不知道该怎么做.您可以使用此网站对其进行测试 http://grokdebug.herokuapp.com/
I thought to add some patterns between ()?,but i don't know exactly how to do it.you can use this site to test it http://grokdebug.herokuapp.com/
有什么需要帮助的吗?我该怎么办:(
Any help please? What should i do :(
推荐答案
Logstash支持键值值,请查看 http://logstash.net/docs/1.4.2/filters/kv .
Logstash supports key-value Values, take a look at http://logstash.net/docs/1.4.2/filters/kv.
或者您可以使用多个匹配值:
Or you could use multiple match values:
grok {
patterns_dir => "./patterns"
match => [
"message", "%{BASE_PATTERN} %{EXTRA_PATTERN}",
"message", "%{BASE_PATTERN}",
"message", "%{SOME_OTHER_PATTERN}"
]
}
这篇关于我的日志文件中几行中的结构不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!