diff --git a/adapters/syslog/syslog.go b/adapters/syslog/syslog.go index eb1b32a1..b0aa704c 100644 --- a/adapters/syslog/syslog.go +++ b/adapters/syslog/syslog.go @@ -9,6 +9,7 @@ import ( "net" "os" "reflect" + "strings" "text/template" "time" @@ -132,3 +133,13 @@ func (m *SyslogMessage) Timestamp() string { func (m *SyslogMessage) ContainerName() string { return m.Message.Container.Name[1:] } + +func (m *SyslogMessage) Env(key string) string { + envValues := m.Message.Container.Config.Env + for _, env := range envValues { + if strings.HasPrefix(env, key) { + return env[len(key)+1:] + } + } + return "" +}