only set logfile dir if media is file (#615)
This commit is contained in:
parent
2888bda959
commit
7f40160f6e
3 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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:"-"`
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue