From 0dcde3e7af05f166890228c351f232c1b82a858d Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Sat, 4 Nov 2017 15:14:39 +0100 Subject: We'll lose some lines at restart, but we'll pick up new containers ... actually getting amazingly close to the result from filebeat or fluentd. The `==> [filename] <==` messages give the filename for coming nessages up to the next such line (thanks to `tail`) and the filenames all have the pattern pod-name_namespace_container-name_id.log A streams application could process this and pass messages to another topic, after adding labels and annotations from kube API, either as very long keys or wrapping as json like fluentd or filebeat does. --- logs-streaming/logs-kube-kafka.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/logs-streaming/logs-kube-kafka.yml b/logs-streaming/logs-kube-kafka.yml index f9d0e8a..423c2d7 100644 --- a/logs-streaming/logs-kube-kafka.yml +++ b/logs-streaming/logs-kube-kafka.yml @@ -23,6 +23,7 @@ spec: - sh - -ec - > + find /var/log/containers/ -maxdepth 1 -name *.log | tee /tmp/start-list; cd /var/log/containers/; tail -n 0 @@ -36,6 +37,14 @@ spec: -z snappy -v -d broker,topic + livenessProbe: + exec: + command: + - /bin/sh + - -c + - find /var/log/containers/ -maxdepth 1 -name *.log | diff - /tmp/start-list + initialDelaySeconds: 5 + periodSeconds: 5 resources: limits: memory: 100Mi -- cgit v1.2.3