我的Logstash转发器在logstash服务器的某个不同主机上运行。现在我想从logstashforwarder读取日志的位置发送文件的确切路径信息。有什么方法可以做到这一点..下面是我的logstash-forwarder conig文件
{
"network": {
"servers": [ "10.93.69.55:5002"],
"timeout": 15,
"ssl ca": "/home/lambda/gitprojects/logstash-forwarder/logstash-forwarder.crt"
},
"files": [
{
"paths": [
"/home/lambda/deployments/dashboard/src/log/*.log"
],
"fields": { "type": "dashboard" }
}
]
}
如上所示,我使用* .log来包含错误日志文件(error.log,process.log等)。现在我想将文件名和日志一起发送到logstash服务器。
答案 0 :(得分:0)
定义多个文件输入并根据文件的路径添加新字段。伪配置:
input {
file {
type => "serverlog"
path => [ "/log/error*.log" ]
add_field => { "file_source" => "error" }
}
file {
type => "serverlog"
path => [ "/log/process*.log" ]
add_field => { "file_source" => "process" }
}
}