使用 Fluentd 问题在 Kubernetes 中登录 ASP.Net Core sidecar

如何解决使用 Fluentd 问题在 Kubernetes 中登录 ASP.Net Core sidecar

我有一个 K8s 部署,它沿着它的 sidecar 部署一个应用程序的容器(一个 ASP.Net Core 应用程序)以进行日志记录。我使用 Serilog 的控制台接收器来登录标准输出。我还有一个配置映射来存储 fluentd 的配置。关于这部分的一篇非常好的文章this

我想要做的是使用 sidecar 将日志从应用程序转发到 Elastic Search。我使用相应的输出插件来做到这一点。但是应该在源代码和过滤器标签中使用什么来实现这一点?

fluentd的配置如下:

      <source>
        @type forward
        port 24224
        bind 0.0.0.0
      </source>
        
      <filter *.**="">
        @type parser
        key_name log
        format json
        reserve_data true
      </filter>
        
      <match *.**="">
        @type copy
        <store>
        @type elasticsearch
        host 192.168.1.41
        port 9200
        logstash_format true
        logstash_prefix fluentd
        logstash_dateformat %Y%m%d
        include_tag_key true
        user elastic
        index_name "ap-*"
        password xxxxxxxxx
        type_name access_log
        tag_key @log_name
        flush_interval 1s
        </store>
        <store>
        @type stdout
        </store>
      </match>

使用此配置,fluentd 工作正常,但我没有收到任何转发到 Elastic Search 的消息。

这里是 fluentd 的日志

2021-04-08 11:37:25 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluent.conf"
2021-04-08 11:37:25 +0000 [info]: gem 'fluent-plugin-elasticsearch' version '5.0.2'
2021-04-08 11:37:25 +0000 [info]: gem 'fluentd' version '1.12.2'
2021-04-08 11:37:25 +0000 [info]: 'flush_interval' is configured at out side of <buffer>. 'flush_mode' is set to 'interval' to keep existing behavIoUr
2021-04-08 11:37:25 +0000 [info]: using configuration file: <ROOT>
  <source>
    @type forward
    port 24224
    bind "0.0.0.0"
  </source>
  <filter *.**="">
    @type parser
    key_name "log"
    format json
    reserve_data true
    <parse>
      @type json
    </parse>
  </filter>
  <match *.**="">
    @type copy
    <store>
      @type "elasticsearch"
      host "192.168.1.41"
      port 9200
      logstash_format true
      logstash_prefix "fluentd"
      logstash_dateformat "%Y%m%d"
      include_tag_key true
      user "elastic"
      index_name "catalogapi-*"
      password xxxxxx
      type_name "access_log"
      tag_key "@log_name"
      flush_interval 1s
      <buffer>
        flush_interval 1s
      </buffer>
    </store>
    <store>
      @type "stdout"
    </store>
  </match>
</ROOT>
2021-04-08 11:37:25 +0000 [info]: starting fluentd-1.12.2 pid=7 ruby="2.6.6"
2021-04-08 11:37:25 +0000 [info]: spawn command to main:  cmdline=["/usr/local/bin/ruby","-Eascii-8bit:ascii-8bit","/usr/local/bundle/bin/fluentd","-c","/fluentd/etc/fluent.conf","-p","/fluentd/plugins","--under-supervisor"]
2021-04-08 11:37:26 +0000 [info]: adding filter pattern="*.**=\"\"" type="parser"
2021-04-08 11:37:26 +0000 [info]: adding match pattern="*.**=\"\"" type="copy"
2021-04-08 11:37:26 +0000 [info]: #0 'flush_interval' is configured at out side of <buffer>. 'flush_mode' is set to 'interval' to keep existing behavIoUr
2021-04-08 11:37:26 +0000 [warn]: #0 Detected ES 7.x: `_doc` will be used as the document `_type`.
2021-04-08 11:37:26 +0000 [info]: adding source type="forward"
2021-04-08 11:37:26 +0000 [info]: #0 starting fluentd worker pid=16 ppid=7 worker=0
2021-04-08 11:37:26 +0000 [info]: #0 listening port port=24224 bind="0.0.0.0"

我进行了多次尝试,使用各种配置,但没有任何效果

提前感谢您的时间。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?