mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add NILVALUE for STRUCTURED-DATA in RFC5424 logs
RFC 5424 (https://tools.ietf.org/html/rfc5424#section-6.2) requires that STRUCTURED-DATA be present, either as NILVALUE (-) or as one or more SD-ELEMENT items. Because Docker doesn't ever create any SD-ELEMENT items, the format should output the NILVALUE instead. This resolves parsing issues in various RFC 5424-compliant syslog servers. Signed-off-by: Mark Parker <godefroi@gmail.com>
This commit is contained in:
parent
e07c392c49
commit
b7d802bbcc
1 changed files with 2 additions and 2 deletions
|
@ -68,7 +68,7 @@ func init() {
|
||||||
func rfc5424formatterWithAppNameAsTag(p syslog.Priority, hostname, tag, content string) string {
|
func rfc5424formatterWithAppNameAsTag(p syslog.Priority, hostname, tag, content string) string {
|
||||||
timestamp := time.Now().Format(time.RFC3339)
|
timestamp := time.Now().Format(time.RFC3339)
|
||||||
pid := os.Getpid()
|
pid := os.Getpid()
|
||||||
msg := fmt.Sprintf("<%d>%d %s %s %s %d %s %s",
|
msg := fmt.Sprintf("<%d>%d %s %s %s %d %s - %s",
|
||||||
p, 1, timestamp, hostname, tag, pid, tag, content)
|
p, 1, timestamp, hostname, tag, pid, tag, content)
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func rfc5424formatterWithAppNameAsTag(p syslog.Priority, hostname, tag, content
|
||||||
func rfc5424microformatterWithAppNameAsTag(p syslog.Priority, hostname, tag, content string) string {
|
func rfc5424microformatterWithAppNameAsTag(p syslog.Priority, hostname, tag, content string) string {
|
||||||
timestamp := time.Now().Format("2006-01-02T15:04:05.999999Z07:00")
|
timestamp := time.Now().Format("2006-01-02T15:04:05.999999Z07:00")
|
||||||
pid := os.Getpid()
|
pid := os.Getpid()
|
||||||
msg := fmt.Sprintf("<%d>%d %s %s %s %d %s %s",
|
msg := fmt.Sprintf("<%d>%d %s %s %s %d %s - %s",
|
||||||
p, 1, timestamp, hostname, tag, pid, tag, content)
|
p, 1, timestamp, hostname, tag, pid, tag, content)
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue