【问题标题】:serilog not sending logs to logstashserilog 没有将日志发送到 logstash
【发布时间】: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 上。 任何帮助将不胜感激..

【问题讨论】:

    标签: .net logstash serilog elk


    【解决方案1】:

    sink Serilog.Sinks.Http 附带了一堆示例应用程序,所有这些示例应用程序都列在自述文件中。其中一个示例演示了您的特定设置,您可以找到它here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-09
      • 1970-01-01
      • 2014-08-29
      相关资源
      最近更新 更多