pub struct EveJsonWriter<W>where
W: Write,{ /* private fields */ }Available on crate features
emit-eve and emit only.Expand description
Suricata EVE JSON writer. One JSON object per line.
Each write_event call: clears the per-event JSON Map,
fills the required + optional fields, calls
serde_json::to_writer straight into the sink, then writes
the trailing newline. No intermediate string allocation per
event.
Implementations§
Source§impl<W> EveJsonWriter<W>where
W: Write,
impl<W> EveJsonWriter<W>where
W: Write,
Sourcepub fn with_options(sink: W, options: EveOptions) -> Self
pub fn with_options(sink: W, options: EveOptions) -> Self
Construct with custom options.
Sourcepub fn write_event<K>(&mut self, ev: &FlowEvent<K>) -> Result<()>where
K: KeyFields,
pub fn write_event<K>(&mut self, ev: &FlowEvent<K>) -> Result<()>where
K: KeyFields,
Write one event. Skipped variants per
EveOptions produce no output and return Ok(()).
Sourcepub fn write_owned_anomaly(&mut self, a: &OwnedAnomaly) -> Result<()>
pub fn write_owned_anomaly(&mut self, a: &OwnedAnomaly) -> Result<()>
Emit event_type: "anomaly" from a canonical
crate::OwnedAnomaly.
Schema mapping:
kind→anomaly.eventseverity→severity(viaEveOptions::severity_numeric)(src_ip, src_port, dest_ip, dest_port, proto)→ top-level fields (each omitted ifNone)observations→anomaly.labels.<label>: <value>metrics→anomaly.metrics.<label>: <number>anomaly.type←EveOptions::custom_anomaly_typeunlessflowscope_kind.is_some(), in which case the typed kind’scrate::AnomalyFields::anomaly_typetakes precedence (for bridged events).
See crate::OwnedAnomaly for canonical detector-
shaped emission. Use Self::write_event for
flowscope-internal FlowEvent variants.
Auto Trait Implementations§
impl<W> Freeze for EveJsonWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for EveJsonWriter<W>where
W: RefUnwindSafe,
impl<W> Send for EveJsonWriter<W>where
W: Send,
impl<W> Sync for EveJsonWriter<W>where
W: Sync,
impl<W> Unpin for EveJsonWriter<W>where
W: Unpin,
impl<W> UnsafeUnpin for EveJsonWriter<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for EveJsonWriter<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more