1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! 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:?}"),
//! });
//! # Ok::<(), goliath_normalize::DefinitionError>(())
//! ```
// Tests assert on outcomes; a failed assertion should abort the test.
pub use SourceDefinition;
pub use DefinitionError;
pub use ;
pub use ;
/// The Sysmon source definition shipped with this crate.
pub const SYSMON: &str = include_str!;
/// The Falco source definition shipped with this crate.
pub const FALCO: &str = include_str!;
/// The Microsoft Entra ID sign-in log definition shipped with this crate.
pub const ENTRA: &str = include_str!;
/// The Linux audit log definition shipped with this crate.
pub const AUDITD: &str = include_str!;
/// Every definition shipped with this crate, by name.
pub const BUILTIN: & = &;
/// The shipped definition named `name`, if there is one.