小编use*_*099的帖子

logstash输出到文件并忽略编解码器

可以请有人向我解释,为什么logstash一直忽略"codec => plain => format"设置,我试图设置?

我正在使用的Cfg文件:

 input {
        gelf {
                host => "[some ip]"
                port => 12201
        }
}

output {
        elasticsearch {
                host => "[some ip]"
                bind_port => "9301"
        }

        file {
                codec => plain {
                        format => "%{[time]} | %{[severity]} : /%{[thread]}/ %{[loggername]} (%{[sourcemethodname]}) - %{[message]}"
                }
                path => "/Users/[some user]/logs/%{host}/%{facility}-%{+YYYY-MM-dd}.log"
        }
}
Run Code Online (Sandbox Code Playgroud)

我以为我使用了错误的格式,为字段尝试了不同的组合,如"%{time}",甚至尝试使用常量文本,如:

codec => plain {format => "Simple line"}
Run Code Online (Sandbox Code Playgroud)

但似乎没有任何效果.它输出到elasticsearch罚款,创建文件夹/文件,但输出为JSON.

如果有人知道它发生了什么,请帮忙.谢谢.

file logstash output

6
推荐指数
2
解决办法
3万
查看次数

标签 统计

file ×1

logstash ×1

output ×1