fix config parser error
This commit is contained in:
parent
f83b7a9d58
commit
f42daec17a
|
@ -18,24 +18,24 @@ const (
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Logs struct {
|
Logs struct {
|
||||||
APIKey string `mapstructure:"api_key" toml:"api_key"`
|
APIKey string `json:"api_key" toml:"api_key"`
|
||||||
Enable bool `mapstructure:"enable" toml:"enable"`
|
Enable bool `json:"enable" toml:"enable"`
|
||||||
SendTo string `mapstructure:"send_to" toml:"send_to"`
|
SendTo string `json:"send_to" toml:"send_to"`
|
||||||
SendType string `mapstructure:"send_type" toml:"send_type"`
|
SendType string `json:"send_type" toml:"send_type"`
|
||||||
UseCompression bool `mapstructure:"use_compression" toml:"use_compression"`
|
UseCompression bool `json:"use_compression" toml:"use_compression"`
|
||||||
CompressionLevel int `mapstructure:"compression_level" toml:"compression_level"`
|
CompressionLevel int `json:"compression_level" toml:"compression_level"`
|
||||||
SendWithTLS bool `mapstructure:"send_with_tls" toml:"send_with_tls"`
|
SendWithTLS bool `json:"send_with_tls" toml:"send_with_tls"`
|
||||||
BatchWait int `mapstructure:"batch_wait" toml:"batch_wait"`
|
BatchWait int `json:"batch_wait" toml:"batch_wait"`
|
||||||
RunPath string `mapstructure:"run_path" toml:"run_path"`
|
RunPath string `json:"run_path" toml:"run_path"`
|
||||||
OpenFilesLimit int `mapstructure:"open_files_limit" toml:"open_files_limit"`
|
OpenFilesLimit int `json:"open_files_limit" toml:"open_files_limit"`
|
||||||
ScanPeriod int `mapstructure:"scan_period" toml:"scan_period"`
|
ScanPeriod int `json:"scan_period" toml:"scan_period"`
|
||||||
FrameSize int `mapstructure:"frame_size" toml:"frame_size"`
|
FrameSize int `json:"frame_size" toml:"frame_size"`
|
||||||
CollectContainerAll bool `mapstructure:"collect_container_all" toml:"collect_container_all"`
|
CollectContainerAll bool `json:"collect_container_all" toml:"collect_container_all"`
|
||||||
GlobalProcessingRules []*logsconfig.ProcessingRule `mapstructure:"processing_rules" toml:"processing_rules"`
|
GlobalProcessingRules []*logsconfig.ProcessingRule `json:"processing_rules" toml:"processing_rules"`
|
||||||
Items []*logsconfig.LogsConfig `mapstructure:"items" toml:"items"`
|
Items []*logsconfig.LogsConfig `json:"items" toml:"items"`
|
||||||
}
|
}
|
||||||
LogType struct {
|
LogType struct {
|
||||||
Logs Logs `toml:"logs"`
|
Logs *Logs `json:"logs" toml:"logs"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ func InitLogConfig(configDir string) error {
|
||||||
return fmt.Errorf("failed to load config: %s, err: %s", configFile, err)
|
return fmt.Errorf("failed to load config: %s, err: %s", configFile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
LogConfig = &data.Logs
|
LogConfig = data.Logs
|
||||||
if Config != nil && Config.Global.PrintConfigs {
|
if Config != nil && Config.Global.PrintConfigs {
|
||||||
bs, _ := json.MarshalIndent(LogConfig, "", " ")
|
bs, _ := json.MarshalIndent(LogConfig, "", " ")
|
||||||
fmt.Println(string(bs))
|
fmt.Println(string(bs))
|
||||||
|
|
|
@ -56,7 +56,7 @@ type LogsConfig struct {
|
||||||
|
|
||||||
// used as input only by the Channel tailer.
|
// used as input only by the Channel tailer.
|
||||||
// could have been unidirectional but the tailer could not close it in this case.
|
// could have been unidirectional but the tailer could not close it in this case.
|
||||||
Channel chan *ChannelMessage
|
Channel chan *ChannelMessage `json:"-"`
|
||||||
|
|
||||||
Service string
|
Service string
|
||||||
Source string
|
Source string
|
||||||
|
|
Loading…
Reference in New Issue