浏览代码

Merge pull request #30694 from godefroi/26937-fix-rfc5424-log-format-1

Add NILVALUE for STRUCTURED-DATA in RFC5424 logs
Vincent Demeester 8 年之前
父节点
当前提交
14790e4008
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      daemon/logger/syslog/syslog.go

+ 2 - 2
daemon/logger/syslog/syslog.go

@@ -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
 }
 }