【发布时间】:2016-06-03 23:52:33
【问题描述】:
我发现 logstash 不是我的过滤器的粉丝。要是能有第二双眼睛就好了。
首先 - 我的日志文件 - 有以下条目,每个卷都有新行。
/vol/vol0/ 298844160 6916836 291927324 2% /vol/vol0/
我的配置文件如下:
输入
file {
type => "testing"
path => "/opt/log_repo/ssh/netapp/*"
tags => "netapp"
start_position => "beginning"
sincedb_path => "/dev/null"
}
过滤器
if [type] == "testing" {
grok{
match => [ "@message", "{UNIXPATH:volume}%{SPACE}%{INT:total}%{SPACE}%{INT:used}%{SPACE}%{INT:avail}%{SPACE}%{PROG:cap}%{SPACE}%{UNIXPATH:vols}"]
}
}
输出
if [type] == "testing" {
elasticsearch {
action => "index"
hosts => ["http://localhost:9200"]
index => ["testing4-%{+YYYY.MM.dd}"]
}
}
当我运行它时,它告诉我它有一个错误的配置文件。如果我将过滤器更改为:
match => [ "@message", "{UNIXPATH:volume}" ]
它使用卷名创建一个名为 volume 的新字段。我正在使用空间组件,因为日志根本不一致。有些卷在可用空间之间会有 4 个空格,而有些则或多或少取决于卷名和大小。
为了获得这种配置,我利用了以下站点: https://grokdebug.herokuapp.com/discover?# http://grokconstructor.appspot.com/do/constructionstep
仍在为我所缺少的东西而苦苦挣扎....任何帮助将不胜感激。
更新:在下面添加推荐后,它仍然不会创建新字段。
_index string
message string
type string
tags string
path string
@timestamp date
@version string
host string
_source _source
_id string
_type string
_score
【问题讨论】: