From 90ed4e10d46512d8a832db3f11c3a19005074aa0 Mon Sep 17 00:00:00 2001 From: fukusuket <41001169+fukusuket@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:46:16 +0900 Subject: [PATCH] feat: add multi line option --- src/detections/configs.rs | 5 +++++ src/timeline/timelines.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 733bbdb26..735e0a3e9 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -373,6 +373,7 @@ impl StoredStatic { let multiline_flag = match &input_config.as_ref().unwrap().action { Some(Action::CsvTimeline(opt)) => opt.multiline, Some(Action::Search(opt)) => opt.multiline, + Some(Action::LogMetrics(opt)) => opt.multiline, _ => false, }; let proven_rule_flag = match &input_config.as_ref().unwrap().action { @@ -1769,6 +1770,10 @@ pub struct LogMetricsOption { #[clap(flatten)] pub time_format_options: TimeFormatOptions, + /// Output event field information in multiple rows for CSV output + #[arg(help_heading = Some("Output"), short = 'M', long="multiline", display_order = 390)] + pub multiline: bool, + /// Overwrite files when saving #[arg(help_heading = Some("General Options"), short='C', long = "clobber", display_order = 290, requires = "output")] pub clobber: bool, diff --git a/src/timeline/timelines.rs b/src/timeline/timelines.rs index 04a53e624..5219808c7 100644 --- a/src/timeline/timelines.rs +++ b/src/timeline/timelines.rs @@ -582,6 +582,11 @@ impl Timeline { { return None; } + let sep = if stored_static.multiline_flag { + "\n" + } else { + sep + }; let ab_ch: Vec = rec .channels .iter()