I am really new to kubernetes and have testing app with redis and mongodb running in GCE. I would like to grap my log files with fluentd and send them to logz:
I use the following fluentd config file. I tested a similar version on my local machine.
<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>
My kubernetes configuration is:
---
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
Almost everything works, but when I run the fluentd pods I see the following entries in the log output from these pods:
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
How can I get permissions to those log files?