mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
This introduces a new firewall.request-logger.disable config option to completely disable request logging. When disabled, the request logger interceptor is not instantiated, avoiding all logging overhead including database writes and request processing. This is implemented as a separate disable flag rather than adding a new log level because the goal is to bypass the logging system entirely for performance reasons, not just filter events. A log level would still process and filter each request through the interceptor. The change also adds validation to ensure autopilot remains enabled only when request logging is active, since autopilot relies on action logs for rule enforcement and auditing.
32 lines
1.3 KiB
Go
32 lines
1.3 KiB
Go
package firewall
|
|
|
|
// Config holds all config options for the firewall.
|
|
//
|
|
//nolint:ll
|
|
type Config struct {
|
|
RequestLogger *RequestLoggerConfig `group:"request-logger" namespace:"request-logger" description:"request logger settings"`
|
|
}
|
|
|
|
// RequestLoggerConfig holds all the config options for the request logger.
|
|
//
|
|
//nolint:ll
|
|
type RequestLoggerConfig struct {
|
|
// Disable completely disables request logging. This option exists as a
|
|
// separate flag rather than a log level because there are scenarios
|
|
// where logging should be entirely skipped (no interceptor, no
|
|
// database writes) rather than just filtered. Disabling improves
|
|
// performance by avoiding all logging overhead, whereas a log level
|
|
// would still process and filter each request.
|
|
Disable bool `long:"disable" description:"Disable request logging completely. If set, autopilot.disable must also be set"`
|
|
RequestLoggerLevel RequestLoggerLevel `long:"level" description:"Set the request logger level. Options include 'all', 'full' and 'interceptor''"`
|
|
}
|
|
|
|
// DefaultConfig constructs the default firewall Config struct.
|
|
func DefaultConfig() *Config {
|
|
return &Config{
|
|
RequestLogger: &RequestLoggerConfig{
|
|
Disable: false,
|
|
RequestLoggerLevel: RequestLoggerLevelInterceptor,
|
|
},
|
|
}
|
|
}
|