Skip to content

Commit

Permalink
only set logfile dir if media is file (crowdsecurity#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
buixor authored Feb 11, 2021
1 parent 2888bda commit 7f40160
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewServer(config *csconfig.LocalApiServerCfg) (*APIServer, error) {
}

logFile := ""
if config.LogDir != "" {
if config.LogDir != "" && config.LogMedia == "file" {
logFile = fmt.Sprintf("%s/crowdsec_api.log", config.LogDir)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/csconfig/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type LocalApiServerCfg struct {
TLS *TLSCfg `yaml:"tls"`
DbConfig *DatabaseCfg `yaml:"-"`
LogDir string `yaml:"-"`
LogMedia string `yaml:"-"`
OnlineClient *OnlineApiClientCfg `yaml:"online_client"`
ProfilesPath string `yaml:"profiles_path,omitempty"`
Profiles []*ProfileCfg `yaml:"-"`
Expand Down
1 change: 1 addition & 0 deletions pkg/csconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (c *GlobalConfig) LoadConfiguration() error {
if c.API.Server != nil && !c.DisableAPI {
c.API.Server.DbConfig = c.DbConfig
c.API.Server.LogDir = c.Common.LogDir
c.API.Server.LogMedia = c.Common.LogMedia
if err := c.API.Server.LoadProfiles(); err != nil {
return errors.Wrap(err, "while loading profiles for LAPI")
}
Expand Down

0 comments on commit 7f40160

Please sign in to comment.