{"record":{"id":"6025f820bd7f70ec","repo":"crowdsecurity/crowdsec","slug":"unknown-log-format-q","errorCode":null,"errorMessage":"unknown log_format %q","messagePattern":"unknown log_format %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/logging/standard.go","lineNumber":48,"sourceCode":"\tcase \"stdout\":\n\t\t// noop\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown log_mode %q\", cfg.GetMedia())\n\t}\n\n\tlogrus.SetLevel(cmp.Or(level, defLogLevel))\n\n\tswitch cfg.GetFormat() {\n\tcase \"text\", \"\":\n\t\tlogFormatter = &logrus.TextFormatter{\n\t\t\tTimestampFormat: time.RFC3339,\n\t\t\tFullTimestamp:   true,\n\t\t\tForceColors:     forceColors,\n\t\t}\n\tcase \"json\":\n\t\tlogFormatter = &logrus.JSONFormatter{TimestampFormat: time.RFC3339}\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown log_format %q\", cfg.GetFormat())\n\t}\n\n\tlogrus.SetFormatter(logFormatter)\n\n\treturn nil\n}\n","sourceCodeStart":30,"sourceCodeEnd":55,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/logging/standard.go#L30-L55","documentation":"SetupStandardLogger also validates the log format. After resolving the level it switches on cfg.GetFormat(); only 'text' (or empty, meaning default) and 'json' are supported. Any other value returns 'unknown log_format %q' and aborts logger setup. Like the log_mode error, this is a startup-time configuration validation failure.","triggerScenarios":"log_format in the logging config is set to something other than 'text', '', or 'json' — e.g. 'raw', 'logfmt', 'cli', or a value copied from another tool's config.","commonSituations":"Hand-edited config.yaml/dev.yaml; config management templates emitting invalid defaults; confusing crowdsec's log_format with another product's options.","solutions":["Set log_format to 'text' or 'json' (or remove the key to use the default)","Check the quoted value in the error for the typo","Compare against the documented logging options for your crowdsec version","Restart and verify logs render in the chosen format"],"exampleFix":"// before (config.yaml)\ncommon:\n  log_format: logfmt\n// after\ncommon:\n  log_format: json","handlingStrategy":"validation","validationCode":"# Pre-flight check:\n# grep 'log_format' /etc/crowdsec/config.yaml\n# valid values: text | json | (unset for default)","typeGuard":null,"tryCatchPattern":"if err := logging.SetupStandardLogger(cfg); err != nil {\n    return fmt.Errorf(\"invalid logging format: %w\", err)\n}","preventionTips":["Restrict config management templates to documented log_format values","Prefer omitting log_format (defaults to text) unless JSON is needed","Validate config files in CI before rollout","Cross-check options after upgrades"],"tags":["crowdsec","logging","config"],"backgroundTag":"invalid-config-value","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}