diff --git a/cluster/addons/fluentd-gcp/fluentd-gcp-configmap.yaml b/cluster/addons/fluentd-gcp/fluentd-gcp-configmap.yaml index fc6537df1bc..39ee5ee767e 100644 --- a/cluster/addons/fluentd-gcp/fluentd-gcp-configmap.yaml +++ b/cluster/addons/fluentd-gcp/fluentd-gcp-configmap.yaml @@ -301,7 +301,42 @@ data: @type prometheus_monitor + + # This source is used to acquire approximate process start timestamp, + # which purpose is explained before the corresponding output plugin. + + @type exec + command /bin/sh -c 'date +%s' + tag process_start + time_format %Y-%m-%d %H:%M:%S + keys process_start_timestamp + + + # This filter is used to convert process start timestamp to integer + # value for correct ingestion in the prometheus output plugin. + + @type record_transformer + enable_ruby true + auto_typecast true + + process_start_timestamp ${record["process_start_timestamp"].to_i} + + output.conf: |- + # This match is placed before the all-matching output to provide metric + # exporter with a process start timestamp for correct exporting of + # cumulative metrics to Stackdriver. + + @type prometheus + + + type gauge + name process_start_time_seconds + desc Timestamp of the process start in seconds + key process_start_timestamp + + + # We use 2 output stanzas - one to handle the container logs and one to handle # the node daemon logs, the latter of which explicitly sends its logs to the # compute.googleapis.com service rather than container.googleapis.com to keep