Skip to main content

Crate goliath_normalize

Crate goliath_normalize 

Source
Expand description

Declarative source definitions that turn raw log records into OCSF events.

A source definition says, in YAML, how a log source’s bytes split into records, how a record decodes, which kind of record it is, and where each of its fields goes in OCSF. People who know a log source can write one without writing Rust. The model is docs/adr/0007-source-and-parser-model.md.

Nothing a source sends is dropped. A record that cannot become an event is a DeadLetter with its raw bytes intact. A field whose value does not convert is kept as written under unmapped and reported as an Issue, and the event still goes on to detection.

Definitions shipped with this crate live in sources/, each with fixtures of raw records and the events they must produce.

§Example

use goliath_normalize::{Normalizer, Outcome, SYSMON};

let sysmon = Normalizer::from_yaml(SYSMON)?;
let raw = br##"{"Event": {
    "System": {
        "Provider": { "#attributes": { "Name": "Microsoft-Windows-Sysmon" } },
        "EventID": 1,
        "TimeCreated": { "#attributes": { "SystemTime": "2026-09-24T10:15:30.1234567Z" } },
        "Computer": "WS-07"
    },
    "EventData": { "Image": "C:\\Windows\\notepad.exe", "ProcessId": "42", "RuleName": "-" }
}}"##;

sysmon.normalize(raw, |outcome| match outcome {
    Outcome::Event(normalized) => {
        assert_eq!(normalized.event["class_uid"], 1007);
        assert_eq!(normalized.event["process"]["pid"], 42);
        assert_eq!(normalized.event["time"], 1_790_244_930_123_i64);
        // Nothing is dropped: fields the definition does not map are kept.
        assert_eq!(normalized.event["unmapped"]["RuleName"], "-");
    }
    other => panic!("{other:?}"),
});

Re-exports§

pub use definition::SourceDefinition;
pub use error::DefinitionError;
pub use normalizer::DeadLetter;
pub use normalizer::EventId;
pub use normalizer::Issue;
pub use normalizer::Normalized;
pub use normalizer::Normalizer;
pub use normalizer::Outcome;
pub use normalizer::Stage;
pub use wire::Envelope;
pub use wire::WireError;

Modules§

definition
The source definition file format.
error
Error types.
normalizer
Source definitions compiled for use, and records through them.
wire
How outcomes travel between roles.

Constants§

SYSMON
The Sysmon source definition shipped with this crate.