use super::schema::{
ApiPartial, CorrelationPartial, DaemonPartial, EnginePartial, EvalPartial, GlobalPartial,
InputPartial, OutputPartial, RsigmaConfigPartial, StatePartial,
};
pub(crate) const CONFIG_VERSION: u32 = 1;
pub(crate) const LOG_FORMAT: &str = "text";
pub(crate) const API_ADDR: &str = "0.0.0.0:9090";
pub(crate) const INPUT_SOURCE: &str = "stdin";
pub(crate) const INPUT_FORMAT: &str = "auto";
pub(crate) const SYSLOG_TZ: &str = "+00:00";
pub(crate) const SYSLOG_STRIP_BOM: bool = true;
pub(crate) const BUFFER_SIZE: usize = 10_000;
pub(crate) const BATCH_SIZE: usize = 1;
pub(crate) const DRAIN_TIMEOUT: u64 = 5;
pub(crate) const CORRELATION_ACTION: &str = "alert";
pub(crate) const CORRELATION_EVENT_MODE: &str = "none";
pub(crate) const MAX_CORRELATION_EVENTS: usize = 10;
pub(crate) const TIMESTAMP_FALLBACK: &str = "wallclock";
pub(crate) const STATE_SAVE_INTERVAL: u64 = 30;
pub(crate) const OBSERVE_FIELDS_MAX_KEYS: usize = 10_000;
pub(crate) const STDOUT_SINK: &str = "stdout";
pub(crate) const EGRESS_POLICY: &str = "default";
pub(crate) const MATCH_DETAIL: &str = "off";
#[cfg(feature = "daemon-tls")]
pub(crate) const TLS_MIN_VERSION: &str = "1.3";
pub(crate) fn defaults_partial() -> RsigmaConfigPartial {
RsigmaConfigPartial {
version: Some(CONFIG_VERSION),
global: Some(GlobalPartial {
log_format: Some(LOG_FORMAT.to_string()),
color: None,
output_format: None,
}),
daemon: Some(DaemonPartial {
rules: None,
pipelines: Some(Vec::new()),
sources: Some(Vec::new()),
enrichers: None,
api: Some(ApiPartial {
addr: Some(API_ADDR.to_string()),
tls: None,
}),
input: Some(InputPartial {
source: Some(INPUT_SOURCE.to_string()),
format: Some(INPUT_FORMAT.to_string()),
syslog_tz: Some(SYSLOG_TZ.to_string()),
syslog_strip_bom: Some(SYSLOG_STRIP_BOM),
buffer_size: Some(BUFFER_SIZE),
batch_size: Some(BATCH_SIZE),
jq: None,
jsonpath: None,
}),
output: Some(OutputPartial {
sinks: Some(vec![STDOUT_SINK.to_string()]),
dlq: None,
drain_timeout: Some(DRAIN_TIMEOUT),
include_event: Some(false),
pretty: Some(false),
}),
correlation: Some(CorrelationPartial {
suppress: None,
action: Some(CORRELATION_ACTION.to_string()),
event_mode: Some(CORRELATION_EVENT_MODE.to_string()),
max_events: Some(MAX_CORRELATION_EVENTS),
timestamp_fields: None,
timestamp_fallback: Some(TIMESTAMP_FALLBACK.to_string()),
no_detections: Some(false),
}),
state: Some(StatePartial {
db: None,
save_interval: Some(STATE_SAVE_INTERVAL),
}),
engine: Some(EnginePartial {
bloom_prefilter: Some(false),
bloom_max_bytes: None,
observe_fields: Some(false),
observe_fields_max_keys: Some(OBSERVE_FIELDS_MAX_KEYS),
allow_remote_include: Some(false),
cross_rule_ac: Some(false),
match_detail: Some(MATCH_DETAIL.to_string()),
egress_policy: Some(EGRESS_POLICY.to_string()),
}),
nats: None,
}),
eval: Some(EvalPartial {
rules: None,
pipelines: Some(Vec::new()),
input_format: Some(INPUT_FORMAT.to_string()),
syslog_tz: Some(SYSLOG_TZ.to_string()),
syslog_strip_bom: Some(SYSLOG_STRIP_BOM),
fail_on_detection: Some(false),
}),
}
}