Awesome chart, thanks for sharing. For those wanting to use with with the NGINX ingress controller (installed through the Helm chart) and the Promtail Helm chart, here are some instructions.
In the ingress-nginx helm chart add the following config:
controller:
config:
log-format-upstream: '{"msec":"$msec","connection":"$connection","connection_requests":"$connection_requests","pid":"$pid","request_id":"$request_id","request_length":"$request_length","remote_addr":"$remote_addr","remote_user":"$remote_user","remote_port":"$remote_port","time_local":"$time_local","time_iso8601":"$time_iso8601","request":"$request","request_uri":"$request_uri","args":"$args","status":"$status","body_bytes_sent":"$body_bytes_sent","bytes_sent":"$bytes_sent","http_referer":"$http_referer","http_user_agent":"$http_user_agent","http_x_forwarded_for":"$http_x_forwarded_for","http_host":"$http_host","server_name":"$server_name","request_time":"$request_time","upstream":"$upstream_addr","upstream_connect_time":"$upstream_connect_time","upstream_header_time":"$upstream_header_time","upstream_response_time":"$upstream_response_time","upstream_response_length":"$upstream_response_length","upstream_cache_status":"$upstream_cache_status","ssl_protocol":"$ssl_protocol","ssl_cipher":"$ssl_cipher","scheme":"$scheme","request_method":"$request_method","server_protocol":"$server_protocol","pipe":"$pipe","gzip_ratio":"$gzip_ratio","http_cf_ray":"$http_cf_ray","geoip_country_code":"$geoip_country_code"}'
In the Promtail Helm chart add the following:
config:
snippets:
pipelineStages:
- docker:
- match:
selector: '{app="ingress-nginx"}'
stages:
- replace:
expression: '(?:[0-9]{1,3}\.){3}([0-9]{1,3})'
replace: '***'
The "- docker:" pipelineStage is important since without it the JSON is nested within the "log:" entry of the docker log, making it inaccessible for Grafana. This might be different for clusters aren't using Docker for the container runtime. I'm using this on EKS 1.20 which still uses Docker for the container runtime.
August 5th 2021, 12:22 pm
by David van der Spek
Revision: 10