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

syslog: Add support for SYSLOG_TIMESTAMP #260

Merged
merged 1 commit into from
Feb 10, 2017

Conversation

grosskur
Copy link
Contributor

Logspout is currently hardcoded to use RFC3339 timestamps. This can cause problems when using SYSLOG_FORMAT=rfc3164 because some old-fashioned syslog servers insist on "Mmm dd hh:mm:ss" format.

Make logspout more flexible by adding support for a SYSLOG_TIMESTAMP environment variable containing a Go template. This template will be applied to a SyslogMessage value and defaults to {{.Timestamp}}, so there is no change to the current behavior.

Legacy "Mmm dd hh:mm:ss" timestamps can now be specified with:

SYSLOG_TIMESTAMP='{{.Time.Format "Jan 02 15:04:05"}}'

Or RFC3339 timestamps with nanosecond precision can be specified with:

SYSLOG_TIMESTAMP='{{.Time.Format "2006-01-02T15:04:05.999999999Z07:00"}}'

Logspout is currently hardcoded to use RFC3339 timestamps. This can
cause problems when using SYSLOG_FORMAT=rfc3164 because some
old-fashioned syslog servers insist on "Mmm dd hh:mm:ss" format.

Make logspout more flexible by adding support for a SYSLOG_TIMESTAMP
environment variable containing a Go template. This template will be
applied to a SyslogMessage value and defaults to {{.Timestamp}}, so
there is no change to the current behavior.

Legacy "Mmm dd hh:mm:ss" timestamps can now be specified with:

    SYSLOG_TIMESTAMP='{{.Time.Format "Jan 02 15:04:05"}}'

Or RFC3339 timestamps with nanosecond precision can be specified with:

    SYSLOG_TIMESTAMP='{{.Time.Format "2006-01-02T15:04:05.999999999Z07:00"}}'
@mattatcha mattatcha merged commit 513b74c into gliderlabs:master Feb 10, 2017
billimek added a commit to billimek/logspout that referenced this pull request Mar 2, 2017
* upstream/master:
  Dockerfile: use alpine 3.5 to fix build issue from missing context pkg
  syslog: Add support for SYSLOG_TIMESTAMP (gliderlabs#260)
  first pass at tests (gliderlabs#218)
  install ca-certificates fixes gliderlabs#247
  Update README.md
@michaelshobbs michaelshobbs mentioned this pull request Apr 14, 2017
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