【发布时间】:2022-01-14 06:26:27
【问题描述】:
我正在尝试将日志从 c# 控制台应用程序发送到 ELK 堆栈。我关注了这个tutorial 一步一步,但它仍然不起作用。 这是我的 logstash.config 文件:
input {
http {
#default host 0.0.0.0:8080
codec => json
}
}
# Separate the logs
filter {
split {
field => "events"
target => "e"
remove_field => "events"
}
}
# Send the logs to Elasticsearch
output {
elasticsearch {
hosts => "elasticsearch:9200"
index=>"customer-%{+xxxx.ww}"
}
}
我也将RUN logstash-plugin install logstash-input-http 添加到 DOCKERFILE 中,但它不起作用。
如果我从 logstash 容器 cli 发送一个发布请求,它可以工作并显示在 kibana 上:
curl -X POST -H "Content-Type: application/json" -d '{"name:"me"}' http://localhost:8080
但是,如果我使用 HttpClient 类以相同的参数发布,它会显示在 kibana 上。
任何帮助将不胜感激..
【问题讨论】: