Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom log-format #66

Merged
merged 1 commit into from
Nov 15, 2016
Merged

Conversation

df-mreidel
Copy link

I noticed that the log-format could not be customized and created a small patch that makes exactly this possible so everyone can add fields to his or her liking or switch to a totally different format. Use like this to switch to JSON-logging for example:

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-ingress-conf
  namespace: kube-system
data:
  log-format: '{ "@timestamp": "$time_iso8601", "@version": "1", "clientip": "$remote_addr", "tag": "ingress", "remote_user": "$remote_user", "bytes": $bytes_sent, "duration": $request_time, "status": $status, "request": "$request_uri", "urlpath": "$uri", "urlquery": "$args", "method": "$request_method", "referer": "$http_referer", "useragent": "$http_user_agent", "software": "nginx", "version": "$nginx_version", "host": "$host", "upstream": "$upstream_addr", "upstream-status": "$upstream_status" }'

I also noticed that the tempalte engine was html/template, which caused all text inside single quotes to be escaped like it was an HTML attribute. I therefore switched to text/template, I think this was meant to be used anyway.

@pleshakov
Copy link
Contributor

@df-mreidel
Thx! That's very useful.
html/template was used by mistake. Thanks for fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants