diff --git a/src/detections/print.rs b/src/detections/print.rs index fcd031f1..dff39245 100644 --- a/src/detections/print.rs +++ b/src/detections/print.rs @@ -116,7 +116,9 @@ impl Message { if is_exist_event_key { let hash_value = get_serde_number_to_string(tmp_event_record); if let Some(hash_value) = hash_value { - let hash_value = hash_value.replace(r"(\\a|\\f|\\t|\\n|\\r|\\v)", " "); + // UnicodeのWhitespace characterをそのままCSVに出力すると見難いので、スペースに変換する。なお、先頭と最後のWhitespace characterは単に削除される。 + let hash_value: Vec<&str> = hash_value.split_whitespace().collect(); + let hash_value = hash_value.join(" "); hash_map.insert(full_target_str.to_string(), hash_value); } } diff --git a/src/detections/utils.rs b/src/detections/utils.rs index 0dd1a6c6..8dc39e5c 100644 --- a/src/detections/utils.rs +++ b/src/detections/utils.rs @@ -54,7 +54,7 @@ pub fn value_to_string(value: &Value) -> Option { Value::Null => Option::None, Value::Bool(b) => Option::Some(b.to_string()), Value::Number(n) => Option::Some(n.to_string()), - Value::String(s) => Option::Some(s.to_string()), + Value::String(s) => Option::Some(s.trim().to_string()), Value::Array(_) => Option::None, Value::Object(_) => Option::None, }