作者:j7988l28 | 来源:互联网 | 2023-05-19 02:00
测试说明通过filebeat监控nginx日志(已配置为json格式)。之后直接输出到logstash。filebeat配置增加部分:output.logstash:#The
测试说明
通过filebeat监控nginx日志(已配置为json格式)。之后直接输出到logstash。
filebeat配置
增加部分:
output.logstash:
# The Logstash hosts
hosts: [“192.168.100.34:5044”]
index: shopweb
logstash配置
input {
beat {
port => 5044
codec => json
}
}
filter {
mutate {
remove_field => ["tags", "beat"]
}
}
output {
stdout {
codec => rubydebug
}
}
运行输出结果
{
"request" => "POST /dybuat/invest/getBorrowListPage.do?status=1 HTTP/1.1",
"referer" => "http://shopweb.dev/dybuat/invest/index.html?status=1",
"agent" => "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36",
"offset" => 167804,
"input_type" => "log",
"source" => "/var/log/nginx/access.log",
"type" => "log",
"http_host" => "shopweb.dev",
"url" => "/dybuat/invest/getBorrowListPage.do",
"tags" => [
[0] "beats_input_codec_json_applied"
],
"upstreamhost" => "192.168.100.121:8081",
"@timestamp" => 2017-01-17T01:35:26.799Z,
"size" => "13932",
"clientip" => "192.168.20.32",
"host" => "192.168.100.70",
"@version" => "1",
"responsetime" => "0.018",
"xff" => "-",
"fields" => {
"log_source" => "shopweb"
},
"upstreamtime" => "0.018",
"status" => "200"
}