流利的无法将日志发送到syslog

时间:2020-07-23 13:58:40

标签: syslog fluentd

我使用镜像'https://github.com/zarqman/fluent-plugin-syslog-tls'来设置我的fluetd,现在一切似乎都已正确配置,但仍然无法将日志转发到远程syslog服务器。

在调试日志上,我发现流利的无法读取日志文件,这可能是不推送消息的原因。

请参考以下日志-

# ls -ltr
total 0
drwxr-xr-x. 4 root root 45 Jul  2 10:12 kube-system_kube-flannel-ds-n476z_e583aa74-f480-4fc0-a645-d01089f5b38f
drwxr-xr-x. 3 root root 24 Jul  2 10:12 kube-system_kube-proxy-vpb2c_7b1eac3e-75b1-4e72-a1d7-beae245cf14b
drwxr-xr-x. 3 root root 29 Jul  2 10:13 kube-system_proxymux-client-f2wrk_cf2af3a9-2327-41cd-b324-b387a8f41201
drwxr-xr-x. 3 root root 21 Jul  2 10:13 kube-system_coredns-78f8cf49d4-7s5sc_3a6a679f-18b1-42bf-a71c-9e6e600e15d6
drwxr-xr-x. 3 root root 19 Jul  2 11:03 default_nginx_2cb2f7dc-21c6-4f37-9db9-5ab37e3d848b
drwxr-xr-x. 3 root root 19 Jul  2 11:05 default_pd1_684fcc98-4827-48f3-a6d9-eca311dbadc6
drwxr-xr-x. 3 root root 28 Jul 20 10:34 kube-logging_kibana-logging-76fcb79b95-2whms_29f04dcb-5dad-4757-aa8c-e1add34b4f78
drwxr-xr-x. 3 root root 24 Jul 20 10:34 kube-logging_fluentd-es-pqhq9_f64f56bb-74dc-4260-b30f-75234d7c4942
drwxr-xr-x. 4 root root 69 Jul 20 10:35 kube-logging_elasticsearch-logging-0_d4212cb8-e56f-4025-89e4-342593c1c1f7
drwxr-xr-x. 4 root root 69 Jul 20 10:36 kube-logging_elasticsearch-logging-1_2c209eae-a165-406c-bfbe-bc6a0d7df026
drwxr-xr-x. 3 root root 24 Jul 21 10:19 kube-system_kube-dns-autoscaler-69d54587dc-ngjll_2cae55f4-5514-4b32-82c0-7faf0a24a1cd
drwxr-xr-x. 3 root root 29 Jul 21 10:19 kube-system_csi-oci-node-n2nbm_930a38ad-c997-4630-aa57-b94d13b836ba
drwxr-xr-x. 3 root root 21 Jul 21 19:26 kube-logging_fluentd-syslog-jzz5q_d9c6550a-8daf-4885-883d-082151c32b2c
# cd kube-logging_fluentd-syslog-jzz5q_d9c6550a-8daf-4885-883d-082151c32b2c
# ls
fluentd
# cd fluentd
# ls
0.log
# ls -ltr
total 4
lrwxrwxrwx. 1 root root 166 Jul 21 19:26 0.log -> /u01/data/docker/containers/18c3fb4fcc15591834e2c795167a621e17038cc1c4f210bcf93746ace6e1cdfc/18c3fb4fcc15591834e2c795167a621e17038cc1c4f210bcf93746ace6e1cdfc-json.log
# cat /u01/data/docker/containers/18c3fb4fcc15591834e2c795167a621e17038cc1c4f210bcf93746ace6e1cdfc/18c3fb4fcc15591834e2c795167a621e17038cc1c4f210bcf93746ace6e1cdfc-json.log
cat: /u01/data/docker/containers/18c3fb4fcc15591834e2c795167a621e17038cc1c4f210bcf93746ace6e1cdfc/18c3fb4fcc15591834e2c795167a621e17038cc1c4f210bcf93746ace6e1cdfc-json.log: No such file or directory
#

Here is my container logs -

2020-07-21 19:26:07 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluent.conf"
2020-07-21 19:26:07 +0000 [info]: gem 'fluent-plugin-syslog-tls' version '2.0.0'
2020-07-21 19:26:07 +0000 [info]: gem 'fluentd' version '1.11.1'
2020-07-21 19:26:07 +0000 [warn]: [output_docker1] 'time_format' specified without 'time_key', will be ignored
2020-07-21 19:26:07 +0000 [info]: using configuration file: <ROOT>
  <source>
    @id fluentd-pods.log
    @type tail
    path "/var/log/pods/*"
    pos_file "/var/log/fluentd-pods.log.pos"
    time_format %Y-%m-%dT%H:%M:%S.%NZ
    tag "raw.kubernetes.*"
    format json
    read_from_head true
    @label @mainstream
    <parse>
      time_format %Y-%m-%dT%H:%M:%S.%NZ
      @type json
      unmatched_lines
      time_type string
    </parse>
  </source>
  <label @mainstream>
    <match docker.**>
      @type file
      @id output_docker1
      path "/fluentd/log/docker.*.log"
      symlink_path "/fluentd/log/docker.log"
      append true
      time_slice_format %Y%m%d
      time_slice_wait 1m
      time_format %Y%m%dT%H%M%S%z
      <buffer time>
        timekey_wait 1m
        timekey 86400
        path /fluentd/log/docker.*.log
      </buffer>
      <inject>
        time_format %Y%m%dT%H%M%S%z
      </inject>
    </match>
    <match **>
      @type syslog_tls
      @id out_kube_syslog_tls
      host "130.61.8.9"
      port 514
      program fluentd
      hostname "${kubernetes_host}"
      tls true
      protocol tcp
      verify_cert_name true
      client_cert "/cert/tls.crt"
      client_key "/cert/tls.key"
      packet_size 65535
      <format>
        @type "ltsv"
      </format>
    </match>
  </label>
</ROOT>
2020-07-21 19:26:07 +0000 [info]: starting fluentd-1.11.1 pid=7 ruby="2.6.6"
2020-07-21 19:26:07 +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"]
2020-07-21 19:26:08 +0000 [info]: adding match in @mainstream pattern="docker.**" type="file"
2020-07-21 19:26:08 +0000 [warn]: #0 [output_docker1] 'time_format' specified without 'time_key', will be ignored
2020-07-21 19:26:08 +0000 [info]: adding match in @mainstream pattern="**" type="syslog_tls"
2020-07-21 19:26:08 +0000 [info]: adding source type="tail"
2020-07-21 19:26:08 +0000 [warn]: parameter 'program' in <match **>
  @type syslog_tls
  @id out_kube_syslog_tls
  host "130.61.8.9"
  port 514
  program fluentd
  hostname "${kubernetes_host}"
  tls true
  protocol tcp
  verify_cert_name true
  client_cert "/cert/tls.crt"
  client_key "/cert/tls.key"
  packet_size 65535
  <format>
    @type "ltsv"
  </format>
</match> is not used.
2020-07-21 19:26:08 +0000 [warn]: parameter 'tls' in <match **>
  @type syslog_tls
  @id out_kube_syslog_tls
  host "130.61.8.9"
  port 514
  program fluentd
  hostname "${kubernetes_host}"
  tls true
  protocol tcp
  verify_cert_name true
  client_cert "/cert/tls.crt"
  client_key "/cert/tls.key"
  packet_size 65535
  <format>
    @type "ltsv"
  </format>
</match> is not used.
2020-07-21 19:26:08 +0000 [warn]: parameter 'protocol' in <match **>
  @type syslog_tls
  @id out_kube_syslog_tls
  host "130.61.8.9"
  port 514
  program fluentd
  hostname "${kubernetes_host}"
  tls true
  protocol tcp
  verify_cert_name true
  client_cert "/cert/tls.crt"
  client_key "/cert/tls.key"
  packet_size 65535
  <format>
    @type "ltsv"
  </format>
</match> is not used.
2020-07-21 19:26:08 +0000 [warn]: parameter 'packet_size' in <match **>
  @type syslog_tls
  @id out_kube_syslog_tls
  host "130.61.8.9"
  port 514
  program fluentd
  hostname "${kubernetes_host}"
  tls true
  protocol tcp
  verify_cert_name true
  client_cert "/cert/tls.crt"
  client_key "/cert/tls.key"
  packet_size 65535
  <format>
    @type "ltsv"
  </format>
</match> is not used.
2020-07-21 19:26:08 +0000 [info]: #0 starting fluentd worker pid=17 ppid=7 worker=0
2020-07-21 19:26:08 +0000 [info]: #0 fluentd worker is now running worker=0

0 个答案:

没有答案