我正在尝试将日志从Kubernetes推送到splunk,使用fluentd作为守护进程。
当我设置format none和push to splunk时,它起作用了。但是我想添加kubernetes_metadata,所以我更新了format json并添加了kubernetes_metadata过滤器。
然后,我收到一个400 Bad Request
{"text": "Invalid data format", "code": 6, "invalid-event-number": 0 }这是我的fluent.conf文件
# Ignore fluentd log messages
<match fluent.**>
@type null
</match>
<source>
@type tail
path /var/log/containers/*.log
pos_file /fluentd/log/docker-containers.log.pos
tag kubernetes.*
format json
read_from_head true
</source>
<filter kubernetes.**>
@type kubernetes_metadata
</filter>
<match kubernetes.**>
@type splunk-http-eventcollector
server <host>:8088
protocol https
verify false
token ***
source fluentd-kube-containers
sourcetype _json
host "#{ENV['HOSTNAME']}"
buffer_chunk_limit 700k
batch_size_limit 1000000
buffer_type file
buffer_path /fluentd/log/fluentd-buffer
flush_interval 10s
</match>发布于 2018-03-31 02:40:29
这是我太愚蠢了,我的源代码不是json格式的,所以splunk不喜欢它,我认为我需要在源代码上设置format json来获取Kubernetes元数据的假设是错误的,所以当我设置format none并将all_items true添加到splunk-http-eventcollector中时,它是有效的。
https://stackoverflow.com/questions/49562075
复制相似问题