私はkubernetesには本当に新しく、GCEで実行されるredisとmongodbでテストするアプリケーションを持っています。ログファイルを流暢にしてlogzに送信したい:Kubernetesでfluentdを使ってコンテナログを読むときの許可の問題
私は以下のFluentd設定ファイルを使用します。ローカルマシンでも同様のバージョンをテストしました。
<source>
@type tail
path /var/log/containers/squidex*.log
pos_file /var/log/squidex.log.pos
tag squidex.logs
format json
</source>
<match squidex.logs>
@type copy
<store>
@type logzio_buffered
endpoint_url https://listener.logz.io:8071?token=...
output_include_time true
output_include_tags true
buffer_type file
buffer_path /fluentd/log/squidex.log.buffer
flush_interval 10s
buffer_chunk_limit 1m
</store>
<store>
@type stdout
</store>
</match>
マイkubernetes構成は次のとおりです。
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: fluentd-logging
labels:
app: fluentd-logging
spec:
template:
metadata:
labels:
app: fluentd-logging
spec:
containers:
- name: fluentd
image: gcr.io/squidex-157415/squidex-fluentd:latest
resources:
limits:
memory: 200Mi
requests:
cpu: 40m
volumeMounts:
- name: varlog
mountPath: /var/log
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
ほとんどすべての作品が、私はfluentdポッドを実行したときに、私はこれらのポッドからのログ出力中に次のエントリを参照してください。
2017-04-22T09:49:22.286740784Z 2017-04-22 09:49:22 +0000 [warn]:
/var/log/containers/squidex-282724611-3nhtw_default_squidex-ed7c437e677d3438c137cdc80110d106339999a6ba8e495a5752fe6d5da9e70d.log unreadable.
It is excluded and would be examined next time
これらのログファイルにどのようにアクセス権を与えることができますか?
私はあなたが発行したと思うのは、/ var/log/containersは本当にログファイルを保持していませんが、それらにリンクしています。容器を保持するFSにリンクされるべきである。だからおそらく両方をマウントすべきです –