File tree Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Original file line number Diff line number Diff line change 55 perms : 0666
66 filter :
77 facility : " auth,authpriv"
8+ output :
9+ template : " [SYSLOG] %s"
810
911pipes :
1012 -
1517 path : /docker.stderr
1618 type : stderr
1719 perms : 0666
20+ output :
21+ template : " [STDERR] %s"
Original file line number Diff line number Diff line change @@ -13,13 +13,17 @@ type Pipe struct {
1313 Path string
1414 Type string
1515 Perms string
16+
17+ Output struct {
18+ Template string
19+ }
1620}
1721
1822// Create and handle log data from pipe
1923func handlePipe (pipe Pipe ) {
2024 pipeExists := false
2125
22- LoggerStdout .Verbose (fmt .Sprintf (" -> Starting named pipe (%s)" , pipe .Path ))
26+ LoggerStdout .Verbose (fmt .Sprintf (" -> starting named pipe (%s)" , pipe .Path ))
2327
2428 // get pipe permissions
2529 if pipe .Perms == "" {
@@ -63,11 +67,16 @@ func handlePipe(pipe Pipe) {
6367 }
6468
6569 if message != "" {
70+
71+ if pipe .Output .Template != "" {
72+ message = fmt .Sprintf (pipe .Output .Template , message )
73+ }
74+
6675 switch pipe .Type {
6776 case "stdout" :
68- LoggerStdout .Println (message )
77+ LoggerStdout .Print (message )
6978 case "stderr" :
70- LoggerStderr .Println (message )
79+ LoggerStderr .Print (message )
7180 }
7281 }
7382 }
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ type Syslog struct {
1313 Facility string
1414 facility int
1515 }
16+ Output struct {
17+ Template string
18+ }
1619}
1720
1821
@@ -53,7 +56,7 @@ var SyslogFacilityLookup = map[int]string {
5356}
5457
5558func handleSyslog () {
56- LoggerStdout .Verbose (fmt .Sprintf (" -> Starting syslog daemon (%s)" , configuration .Syslog .Path ))
59+ LoggerStdout .Verbose (fmt .Sprintf (" -> starting syslog daemon (%s)" , configuration .Syslog .Path ))
5760
5861 // Check if syslog path exists, remove if already existing
5962 _ , err := os .Stat (configuration .Syslog .Path )
@@ -77,13 +80,14 @@ func handleSyslog() {
7780 continue
7881 }
7982
80- facilityId := logParts ["facility" ].(int )
81- facility := "custom"
82- if val , ok := SyslogFacilityLookup [facilityId ]; ok {
83- facility = val
83+ // build message
84+ message := logParts ["content" ]
85+
86+ // custom template
87+ if configuration .Syslog .Output .Template != "" {
88+ message = fmt .Sprintf (configuration .Syslog .Output .Template , message )
8489 }
8590
86- message := fmt .Sprintf ("%s: %s" , facility , logParts ["content" ])
8791 LoggerStdout .Println (message )
8892 }
8993 }(channel )
You can’t perform that action at this time.
0 commit comments