Skip to content

Commit

Permalink
Add the <filter></filter> only when logfile environment Variable is set
Browse files Browse the repository at this point in the history
  • Loading branch information
ubhattacharjya committed Aug 28, 2020
1 parent 899e233 commit f25add7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions agent/logger/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ func seelogConfig() string {
<console />`
c += platformLogConfig()
c += `
</filter>
<filter levels="` + getLevelList(Config.instanceLevel) + `">`
</filter>`
if Config.logfile != "" {
c += `
<filter levels="` + getLevelList(Config.instanceLevel) + `">`
if Config.RolloverType == "size" {
c += `
<rollingfile filename="` + Config.logfile + `" type="size"
Expand All @@ -98,9 +99,10 @@ func seelogConfig() string {
<rollingfile filename="` + Config.logfile + `" type="date"
datepattern="2006-01-02-15" archivetype="none" maxrolls="` + strconv.Itoa(Config.MaxRollCount) + `" />`
}
c += `
</filter>`
}
c += `
</filter>
</outputs>
<formats>
<format id="logfmt" format="%EcsAgentLogfmt" />
Expand Down

0 comments on commit f25add7

Please sign in to comment.