goliath-normalize 0.2.6

Declarative source definitions that turn raw log records into OCSF events
Documentation
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
//! How a definition is checked, and how records go through it.

#![allow(clippy::expect_used, clippy::panic)]

use goliath_normalize::{DefinitionError, Normalizer, Outcome, Stage};
use serde_json::json;

const MINIMAL: &str = r"
name: test
version: 3
framing: lines
decoding: json
common:
  metadata.product.name: { value: Test }
kinds:
  - name: login
    when: { type: login }
    class: { class_uid: 3002, activity_id: 1 }
    fields:
      user.name: who
      src_endpoint.port: { from: port, as: integer }
    unmapped: [extra]
";

fn outcomes(definition: &str, input: &str) -> Vec<Outcome> {
    let normalizer = Normalizer::from_yaml(definition).expect("definition loads");
    let mut all = Vec::new();
    normalizer.normalize(input.as_bytes(), |outcome| all.push(outcome));
    all
}

fn one(definition: &str, input: &str) -> Outcome {
    let mut all = outcomes(definition, input);
    assert_eq!(all.len(), 1, "{all:?}");
    all.remove(0)
}

fn error(definition: &str) -> DefinitionError {
    Normalizer::from_yaml(definition).expect_err("definition is rejected")
}

#[test]
fn a_record_becomes_an_event_with_its_class() {
    let Outcome::Event(normalized) = one(
        MINIMAL,
        r#"{"type": "login", "who": "adam", "port": "22", "extra": {"tty": "pts/1"}}"#,
    ) else {
        panic!("not an event");
    };
    assert_eq!(normalized.kind, "login");
    assert!(normalized.issues.is_empty());
    assert_eq!(
        normalized.event,
        json!({
            "class_uid": 3002,
            "category_uid": 3,
            "type_uid": 300_201,
            "activity_id": 1,
            "metadata": { "product": { "name": "Test" } },
            "user": { "name": "adam" },
            "src_endpoint": { "port": 22 },
            "unmapped": { "tty": "pts/1" },
        })
    );
}

#[test]
fn lines_framing_skips_blank_lines_and_carriage_returns() {
    let input = "\r\n{\"type\": \"login\"}\r\n   \n{\"type\": \"login\"}";
    let all = outcomes(MINIMAL, input);
    assert_eq!(all.len(), 2);
    assert!(
        all.iter()
            .all(|outcome| matches!(outcome, Outcome::Event(_)))
    );
}

#[test]
fn a_line_that_is_not_json_is_a_dead_letter_with_its_bytes() {
    let all = outcomes(MINIMAL, "{\"type\": \"login\"}\nnot json\n[1, 2]\n");
    let [
        Outcome::Event(_),
        Outcome::DeadLetter(broken),
        Outcome::DeadLetter(array),
    ] = all.as_slice()
    else {
        panic!("unexpected outcomes: {all:?}");
    };
    assert_eq!(broken.stage, Stage::Decoding);
    assert_eq!(broken.raw, b"not json");
    assert_eq!(array.stage, Stage::Decoding);
    assert_eq!(array.raw, b"[1, 2]");
}

#[test]
fn a_record_no_kind_accepts_is_a_dead_letter() {
    let Outcome::DeadLetter(dead) = one(MINIMAL, r#"{"type": "logout"}"#) else {
        panic!("not a dead letter");
    };
    assert_eq!(dead.stage, Stage::Mapping);
    assert_eq!(dead.raw, br#"{"type": "logout"}"#);
}

#[test]
fn conditions_compare_exactly() {
    // `"1"` is not `1`: a source that changes a type must change its
    // definition, not be matched by accident.
    let definition = MINIMAL.replace("when: { type: login }", "when: { code: 1 }");
    let all = outcomes(&definition, "{\"code\": 1}\n{\"code\": \"1\"}");
    assert!(matches!(all[0], Outcome::Event(_)));
    assert!(matches!(all[1], Outcome::DeadLetter(_)));
}

#[test]
fn a_value_that_does_not_convert_is_kept_and_reported() {
    let Outcome::Event(normalized) = one(MINIMAL, r#"{"type": "login", "port": "ssh"}"#) else {
        panic!("not an event");
    };
    assert_eq!(normalized.issues.len(), 1);
    assert_eq!(normalized.issues[0].target, "src_endpoint.port");
    assert_eq!(normalized.event["unmapped"]["port"], "ssh");
    assert!(normalized.event.get("src_endpoint").is_none());
}

#[test]
fn nulls_and_missing_fields_are_left_out() {
    let Outcome::Event(normalized) = one(
        MINIMAL,
        r#"{"type": "login", "who": null, "extra": {"gone": null}}"#,
    ) else {
        panic!("not an event");
    };
    assert!(normalized.event.get("user").is_none());
    assert!(normalized.event.get("unmapped").is_none());
    assert!(normalized.issues.is_empty());
}

#[test]
fn a_broken_json_stream_keeps_its_remainder() {
    let definition = MINIMAL.replace("framing: lines", "framing: json-values");
    let all = outcomes(&definition, "{\"type\": \"login\"}\n  {\"type\": \"log");
    let [Outcome::Event(_), Outcome::DeadLetter(dead)] = all.as_slice() else {
        panic!("unexpected outcomes: {all:?}");
    };
    assert_eq!(dead.stage, Stage::Framing);
    assert_eq!(dead.raw, b"{\"type\": \"log");
}

#[test]
fn overlapping_targets_are_rejected() {
    let definition = MINIMAL.replace(
        "      user.name: who\n",
        "      user.name: who\n      user: who\n",
    );
    assert!(matches!(
        error(&definition),
        DefinitionError::Overlap { .. }
    ));

    // A kind's field also overlaps a common one.
    let definition = MINIMAL.replace("user.name: who", "metadata.product: who");
    assert!(matches!(
        error(&definition),
        DefinitionError::Overlap { .. }
    ));
}

#[test]
fn class_and_unmapped_attributes_cannot_be_set_by_fields() {
    for target in ["class_uid", "type_uid", "unmapped.x"] {
        let definition = MINIMAL.replace("user.name: who", &format!("{target}: who"));
        assert!(
            matches!(error(&definition), DefinitionError::Reserved { .. }),
            "{target}"
        );
    }
}

#[test]
fn a_kind_without_conditions_is_rejected() {
    let definition = MINIMAL.replace("when: { type: login }", "when: {}");
    assert!(matches!(
        error(&definition),
        DefinitionError::Unconditional { .. }
    ));
}

#[test]
fn malformed_definitions_are_rejected() {
    assert!(matches!(
        error(&MINIMAL.replace("user.name: who", "user..name: who")),
        DefinitionError::Target { .. }
    ));
    assert!(matches!(
        error(&MINIMAL.replace("user.name: who", "user.name: a..b")),
        DefinitionError::SourcePath { .. }
    ));
    assert!(matches!(
        error(&MINIMAL.replace("version: 3", "version: 3\nsurprise: 1")),
        DefinitionError::Yaml(_)
    ));
    assert!(matches!(
        error(&MINIMAL.replace("as: integer", "as: float")),
        DefinitionError::Yaml(_)
    ));
}

#[test]
fn classes_and_activities_must_exist_in_the_schema() {
    assert_eq!(
        error(&MINIMAL.replace("class_uid: 3002", "class_uid: 3999")).to_string(),
        "kind `login`: OCSF 1.5.0 has no class 3999"
    );
    assert_eq!(
        error(&MINIMAL.replace("activity_id: 1", "activity_id: 77")).to_string(),
        "kind `login`: class `authentication` has no activity 77"
    );
}

#[test]
fn targets_must_be_attributes_of_the_class() {
    assert_eq!(
        error(&MINIMAL.replace("user.name: who", "user.nmae: who")).to_string(),
        "kind `login`: `user.nmae`: object `user` has no attribute `nmae`"
    );
    // Common fields are checked against every kind's class.
    assert_eq!(
        error(&MINIMAL.replace("metadata.product.name", "metadata.produce.name")).to_string(),
        "kind `login`: `metadata.produce.name`: object `metadata` has no attribute `produce`"
    );
    assert_eq!(
        error(&MINIMAL.replace("user.name: who", "attacks.technique.uid: who")).to_string(),
        "kind `login`: `attacks.technique.uid` is inside an array, which a field cannot write into"
    );
}

#[test]
fn fields_must_write_what_their_attribute_holds() {
    let cases = [
        (
            "user.name: { value: 5 }",
            "`user.name` holds `username_t`, but the field writes an integer",
        ),
        (
            "user.name: { from: who, as: timestamp }",
            "`user.name` holds `username_t`, but the field writes a timestamp",
        ),
        (
            "user: { value: adam }",
            "`user` holds an object `user`, but the field writes text",
        ),
        (
            "metadata.labels: { value: test }",
            "`metadata.labels` holds an array of `string_t`, but the field writes text",
        ),
        ("time: { from: who, as: integer }", ""),
        (
            "user.name: { value: true }",
            "`user.name` holds `username_t`, but the field writes a boolean",
        ),
    ];
    for (field, message) in cases {
        let definition = MINIMAL.replace("user.name: who", field);
        if message.is_empty() {
            Normalizer::from_yaml(&definition).expect("an integer is a valid timestamp");
        } else {
            assert_eq!(
                error(&definition).to_string(),
                format!("kind `login`: {message}")
            );
        }
    }
    // A copy carries whatever the source holds, so it fits anything.
    Normalizer::from_yaml(&MINIMAL.replace("user.name: who", "user: who")).expect("a copy fits");
}

#[test]
fn enumerated_constants_must_be_defined_values() {
    let definition = MINIMAL.replace("user.name: who", "severity_id: { value: 42 }");
    assert_eq!(
        error(&definition).to_string(),
        "kind `login`: 42 is not a defined value of `severity_id`"
    );
    let definition = MINIMAL.replace("user.name: who", "severity_id: { value: 99 }");
    Normalizer::from_yaml(&definition).expect("99 is Other");
}

#[test]
fn seconds_since_the_epoch_become_milliseconds() {
    let definition = MINIMAL.replace("user.name: who", "time: { from: at, as: unix-seconds }");
    let time = |at: &str| match one(&definition, &format!(r#"{{"type": "login", "at": {at}}}"#)) {
        Outcome::Event(normalized) => (normalized.event.get("time").cloned(), normalized.issues),
        other => panic!("{other:?}"),
    };
    assert_eq!(
        time(r#""1727251200.123""#).0,
        Some(json!(1_727_251_200_123_i64))
    );
    assert_eq!(
        time(r#""1727251200.1""#).0,
        Some(json!(1_727_251_200_100_i64))
    );
    assert_eq!(
        time(r#""1727251200.123456789""#).0,
        Some(json!(1_727_251_200_123_i64))
    );
    assert_eq!(time("1727251200").0, Some(json!(1_727_251_200_000_i64)));
    for bad in [r#""-1.5""#, r#""soon""#, r#""1.2.3""#, r#"".5""#] {
        let (found, issues) = time(bad);
        assert!(found.is_none(), "{bad}");
        assert_eq!(issues.len(), 1, "{bad}");
    }
}

#[test]
fn framing_and_decoding_must_fit_together() {
    let audit_json = MINIMAL.replace("framing: lines", "framing: audit-events");
    assert_eq!(
        error(&audit_json).to_string(),
        "framing `audit-events` cannot be used with decoding `json`"
    );
    let values_auditd = MINIMAL
        .replace("framing: lines", "framing: json-values")
        .replace("decoding: json", "decoding: auditd");
    assert_eq!(
        error(&values_auditd).to_string(),
        "framing `json-values` cannot be used with decoding `auditd`"
    );
}

#[test]
fn audit_lines_are_normalized_by_event() {
    let definition = MINIMAL
        .replace("framing: lines", "framing: audit-events")
        .replace("decoding: json", "decoding: auditd")
        .replace(
            "when: { type: login }",
            "when: { USER_LOGIN.msg.res: success }",
        )
        .replace("user.name: who", "user.name: USER_LOGIN.msg.acct")
        .replace(
            "src_endpoint.port: { from: port, as: integer }",
            "time: { from: time, as: unix-seconds }",
        )
        .replace("unmapped: [extra]", "unmapped: [USER_LOGIN]");
    let log = "type=USER_LOGIN msg=audit(1727251300.000:88): pid=4410 uid=0 msg='op=login acct=\"alice\" res=success'\n\
               garbage\n\
               type=USER_LOGIN msg=audit(1727251301.000:89): pid=4411 uid=0 msg='op=login acct=\"eve\" res=failed'\n";
    let all = outcomes(&definition, log);
    assert_eq!(all.len(), 3);
    let Outcome::Event(alice) = &all[0] else {
        panic!("{:?}", all[0]);
    };
    assert_eq!(alice.event["user"]["name"], "alice");
    assert_eq!(alice.event["time"], 1_727_251_300_000_i64);
    assert_eq!(alice.event["unmapped"]["pid"], "4410");
    let Outcome::DeadLetter(garbage) = &all[1] else {
        panic!("{:?}", all[1]);
    };
    assert_eq!(garbage.stage, Stage::Framing);
    assert_eq!(garbage.raw, b"garbage");
    // No kind accepts a failed login here; its bytes are kept.
    assert!(matches!(&all[2], Outcome::DeadLetter(dead) if dead.stage == Stage::Mapping));
}

#[test]
fn a_name_two_unmapped_objects_share_keeps_both_values() {
    let definition = MINIMAL.replace("unmapped: [extra]", "unmapped: [extra, more]");
    let Outcome::Event(normalized) = one(
        &definition,
        r#"{"type": "login", "extra": {"a0": "id", "tty": "1"}, "more": {"a0": "55d5"}}"#,
    ) else {
        panic!("not an event");
    };
    assert_eq!(
        normalized.event["unmapped"],
        json!({ "a0": "id", "tty": "1", "more.a0": "55d5" })
    );
}

#[test]
fn members_with_dots_in_their_names_are_found() {
    let definition = MINIMAL.replace("user.name: who", "user.name: extra.user.name");
    let Outcome::Event(normalized) = one(
        &definition,
        r#"{"type": "login", "extra": {"user.name": "adam", "proc.pid": 7}}"#,
    ) else {
        panic!("not an event");
    };
    assert_eq!(normalized.event["user"]["name"], "adam");
    // The member it read is not kept twice; the rest are kept by name.
    assert_eq!(normalized.event["unmapped"], json!({ "proc.pid": 7 }));

    // A member named by the segment alone comes first.
    let Outcome::Event(normalized) = one(
        &definition,
        r#"{"type": "login", "extra": {"user": {"name": "eve"}, "user.name": "adam"}}"#,
    ) else {
        panic!("not an event");
    };
    assert_eq!(normalized.event["user"]["name"], "eve");
}

#[test]
fn a_translation_turns_source_words_into_ocsf_values() {
    let definition = MINIMAL.replace(
        "user.name: who",
        "severity_id: { from: level, map: { warn: 3, crit: 5, \"7\": 6 } }",
    );
    let severity = |input: &str| match one(&definition, input) {
        Outcome::Event(normalized) => normalized,
        other => panic!("{other:?}"),
    };
    assert_eq!(
        severity(r#"{"type": "login", "level": "warn"}"#).event["severity_id"],
        3
    );
    // A number is looked up by its text.
    assert_eq!(
        severity(r#"{"type": "login", "level": 7}"#).event["severity_id"],
        6
    );

    // A word the table does not list is kept and reported, not dropped.
    let unlisted = severity(r#"{"type": "login", "level": "loud"}"#);
    assert!(unlisted.event.get("severity_id").is_none());
    assert_eq!(unlisted.event["unmapped"]["level"], "loud");
    assert_eq!(unlisted.issues[0].target, "severity_id");

    // Unless the table says what it becomes.
    let definition = definition.replace("} }", "}, otherwise: 99 }");
    let Outcome::Event(other) = one(&definition, r#"{"type": "login", "level": "loud"}"#) else {
        panic!("not an event");
    };
    assert_eq!(other.event["severity_id"], 99);
    assert!(other.issues.is_empty());
}

#[test]
fn translations_are_checked_when_they_load() {
    let with = |table: &str| MINIMAL.replace("user.name: who", table);
    assert_eq!(
        error(&with(
            "severity_id: { from: level, map: { warn: 3, crit: 42 } }"
        ))
        .to_string(),
        "kind `login`: 42 is not a defined value of `severity_id`"
    );
    assert_eq!(
        error(&with(
            "severity_id: { from: level, map: { warn: 3 }, otherwise: 42 }"
        ))
        .to_string(),
        "kind `login`: 42 is not a defined value of `severity_id`"
    );
    assert_eq!(
        error(&with(
            "severity_id: { from: level, map: { warn: 3, crit: high } }"
        ))
        .to_string(),
        "kind `login`: the translation for `severity_id` mixes values of different types"
    );
    assert_eq!(
        error(&with("severity_id: { from: level, map: {} }")).to_string(),
        "kind `login`: the translation for `severity_id` is empty"
    );
    assert!(matches!(
        error(&with("severity_id: { from: level, map: { warn: high } }")),
        DefinitionError::Type { .. }
    ));
}

#[test]
fn a_record_has_the_same_identity_every_time_it_arrives() {
    let record = r#"{"type": "login", "who": "adam"}"#;
    let id = |input: &str| match one(MINIMAL, input) {
        Outcome::Event(normalized) => normalized.id,
        other => panic!("{other:?}"),
    };
    assert_eq!(id(record), id(record));
    assert_ne!(id(record), id(r#"{"type": "login", "who": "eve"}"#));
    // Only the bytes count: the same event written differently is another
    // record.
    assert_ne!(id(record), id(r#"{"who": "adam", "type": "login"}"#));
}

#[test]
fn identities_separate_sources_and_print_as_hex() {
    use goliath_normalize::EventId;

    assert_ne!(EventId::of("a", b"bc"), EventId::of("ab", b"c"));
    assert_ne!(EventId::of("sysmon", b"x"), EventId::of("auditd", b"x"));
    let text = EventId::of("sysmon", b"x").to_string();
    assert_eq!(text.len(), 32);
    assert!(
        text.bytes()
            .all(|byte| byte.is_ascii_hexdigit() && !byte.is_ascii_uppercase())
    );
}

#[test]
fn outcomes_travel_between_roles_unchanged() {
    use goliath_normalize::{Envelope, WireError};

    let input = "{\"type\": \"login\", \"who\": \"adam\", \"port\": \"x\", \"extra\": {\"tty\": 1}}\nnot json\n";
    for outcome in outcomes(MINIMAL, input) {
        let envelope = Envelope::new("test", 3, outcome);
        let bytes = envelope.encode();
        assert_eq!(bytes[0], 1, "the format byte comes first");
        assert_eq!(Envelope::decode(&bytes).expect("decodes"), envelope);
    }
    assert!(matches!(Envelope::decode(b""), Err(WireError { .. })));
    assert!(
        Envelope::decode(b"\x09{}")
            .expect_err("unknown format")
            .to_string()
            .contains("unknown format 9")
    );
    assert!(Envelope::decode(b"\x01{").is_err());

    // The receipt time travels too, and envelopes written before it existed
    // still read, with none.
    let outcome = outcomes(MINIMAL, "{\"type\": \"login\", \"who\": \"adam\"}\n").remove(0);
    let timed = Envelope::new("test", 3, outcome).received_at(1_790_294_400_000);
    assert_eq!(Envelope::decode(&timed.encode()).expect("decodes"), timed);
    let mut untimed = timed.clone();
    untimed.received = None;
    let old = untimed.encode();
    assert!(!String::from_utf8_lossy(&old).contains("received"));
    assert_eq!(Envelope::decode(&old).expect("decodes").received, None);
}

#[test]
fn identities_read_back_from_their_text() {
    use goliath_normalize::EventId;

    let id = EventId::of("sysmon", b"x");
    assert_eq!(id.to_string().parse::<EventId>().expect("parses"), id);
    assert_eq!(
        id.to_string()
            .to_uppercase()
            .parse::<EventId>()
            .expect("parses"),
        id
    );
    for bad in ["", "abc", &"g".repeat(32), &"a".repeat(33)] {
        assert!(bad.parse::<EventId>().is_err(), "{bad}");
    }
}

const SYSLOG: &str = r"
name: test
version: 1
framing: syslog
decoding: syslog
common:
  time: { from: timestamp, as: timestamp }
  device.hostname: hostname
  message: message
kinds:
  - name: ssh
    when: { app_name: sshd }
    class: { class_uid: 3002, activity_id: 1 }
    fields:
      src_endpoint.port: { from: proc_id, as: integer }
";

#[test]
fn syslog_framing_reads_octet_counted_and_line_messages_alike() {
    let counted = "<38>1 2026-09-28T10:00:00Z bastion sshd 22 - - two\nlines";
    let input = format!(
        "{} {counted}<38>Sep 28 10:00:00 bastion sshd[22]: one line\n40 <38>1 cut short",
        counted.len()
    );
    let all = outcomes(SYSLOG, &input);
    assert_eq!(all.len(), 3, "{all:?}");
    let Outcome::Event(first) = &all[0] else {
        panic!("not an event: {:?}", all[0]);
    };
    assert_eq!(first.event["message"], "two\nlines");
    assert_eq!(first.event["device"]["hostname"], "bastion");
    assert_eq!(first.event["time"], 1_790_589_600_000_i64);
    let Outcome::Event(second) = &all[1] else {
        panic!("not an event: {:?}", all[1]);
    };
    assert_eq!(second.event["message"], "one line");
    assert_eq!(second.event["src_endpoint"]["port"], 22);
    let Outcome::DeadLetter(dead) = &all[2] else {
        panic!("not a dead letter: {:?}", all[2]);
    };
    assert_eq!(dead.stage, Stage::Framing);
    assert_eq!(dead.raw, b"40 <38>1 cut short");
}

#[test]
fn syslog_framing_needs_a_syslog_decoding() {
    assert!(matches!(
        error(&SYSLOG.replace("decoding: syslog", "decoding: json")),
        DefinitionError::Decoding { .. }
    ));
    let json = SYSLOG.replace("decoding: syslog", "decoding: syslog-json");
    let Outcome::Event(normalized) = one(
        &json.replace("message: message", "message: message.text"),
        r#"<38>1 - - sshd - - - {"text":"hi"}"#,
    ) else {
        panic!("not an event");
    };
    assert_eq!(normalized.event["message"], "hi");
}