Merge pull request #39151 from Crassirostris/fluentd-gcp-default-format

Automatic merge from submit-queue

Try parse golang logs by default

Glog by default logs to stderr, so Stackdriver Logging shows them all as errors. This PR makes fluentd try to parse messages using glog format and if succeeded, set timestamp and severity accordingly.

CC @piosz @fgrzadkowski
This commit is contained in:
Kubernetes Submit Queue 2017-01-03 05:50:33 -08:00 committed by GitHub
commit 2d15499984
4 changed files with 14 additions and 6 deletions

View File

@ -2,23 +2,23 @@
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
name: fluentd-gcp-v1.30 name: fluentd-gcp-v1.31
namespace: kube-system namespace: kube-system
labels: labels:
k8s-app: fluentd-gcp k8s-app: fluentd-gcp
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
version: v1.30 version: v1.31
spec: spec:
template: template:
metadata: metadata:
labels: labels:
k8s-app: fluentd-gcp k8s-app: fluentd-gcp
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
version: v1.30 version: v1.31
spec: spec:
containers: containers:
- name: fluentd-gcp - name: fluentd-gcp
image: gcr.io/google_containers/fluentd-gcp:1.30 image: gcr.io/google_containers/fluentd-gcp:1.31
# If fluentd consumes its own logs, the following situation may happen: # If fluentd consumes its own logs, the following situation may happen:
# fluentd fails to send a chunk to the server => writes it to the log => # fluentd fails to send a chunk to the server => writes it to the log =>
# tries to send this message to the server => fails to send a chunk and so on. # tries to send this message to the server => fails to send a chunk and so on.

View File

@ -26,7 +26,7 @@
.PHONY: build push .PHONY: build push
PREFIX=gcr.io/google_containers PREFIX=gcr.io/google_containers
TAG = 1.30 TAG = 1.31
build: build:
docker build -t $(PREFIX)/fluentd-gcp:$(TAG) . docker build -t $(PREFIX)/fluentd-gcp:$(TAG) .

View File

@ -52,6 +52,14 @@
read_from_head true read_from_head true
</source> </source>
<filter reform.**>
type parser
format /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<log>.*)/
reserve_data true
suppress_parse_error_log true
key_name log
</filter>
<match reform.**> <match reform.**>
type record_reformer type record_reformer
enable_ruby true enable_ruby true

View File

@ -10,7 +10,7 @@ spec:
dnsPolicy: Default dnsPolicy: Default
containers: containers:
- name: fluentd-cloud-logging - name: fluentd-cloud-logging
image: gcr.io/google_containers/fluentd-gcp:1.30 image: gcr.io/google_containers/fluentd-gcp:1.31
# If fluentd consumes its own logs, the following situation may happen: # If fluentd consumes its own logs, the following situation may happen:
# fluentd fails to send a chunk to the server => writes it to the log => # fluentd fails to send a chunk to the server => writes it to the log =>
# tries to send this message to the server => fails to send a chunk and so on. # tries to send this message to the server => fails to send a chunk and so on.