Skip to content

Commit

Permalink
Merge pull request gliderlabs#120 from Tomdarkness/rfc5424-structured…
Browse files Browse the repository at this point in the history
…-data-nil

Use correct nilvalue for structured data as per rfc 5424
  • Loading branch information
progrium committed Dec 18, 2015
2 parents 99b8b0a + 5078aa3 commit 421df8e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion adapters/syslog/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ func NewSyslogAdapter(route *router.Route) (router.LogAdapter, error) {
}
data := getopt("SYSLOG_DATA", "{{.Data}}")

if structuredData == "" {
structuredData = "-"
} else {
structuredData = fmt.Sprintf("[%s]", structuredData)
}

var tmplStr string
switch format {
case "rfc5424":
tmplStr = fmt.Sprintf("<%s>1 {{.Timestamp}} %s %s %s - [%s] %s\n",
tmplStr = fmt.Sprintf("<%s>1 {{.Timestamp}} %s %s %s - %s %s\n",
priority, hostname, tag, pid, structuredData, data)
case "rfc3164":
tmplStr = fmt.Sprintf("<%s>{{.Timestamp}} %s %s[%s]: %s\n",
Expand Down

0 comments on commit 421df8e

Please sign in to comment.