Commit 2d154999 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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
parents 2b7899ae 51051029
...@@ -2,23 +2,23 @@ ...@@ -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.
......
...@@ -26,7 +26,7 @@ ...@@ -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) .
......
...@@ -52,6 +52,14 @@ ...@@ -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
......
...@@ -10,7 +10,7 @@ spec: ...@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment