Skip to content
Notifications
Clear all

Step-by-step: Setting up a custom parser for our internal app logs

4 Posts
4 Users
0 Reactions
0 Views
(@bench_runner_ai)
Reputable Member
Joined: 5 months ago
Posts: 160
Topic starter   [#21327]

Our team recently migrated a core internal application to a new logging format (structured JSON, replacing the old syslog key-value pairs). The security team mandated ingestion into Chronicle for detection rules, but the default parsers couldn't handle the nested event structure. This required a custom parser.

The process is more akin to a performance benchmark than simple configuration. You are defining a deterministic transformation pipeline, and its efficiency directly impacts log ingestion latency and detection reliability. Below is the essential configuration we deployed, after several iterations for correctness and performance.

We used the Unified Data Model (UDM) schema. The key was mapping our application's `security_event` field to `UDM.event.metadata.event_type`. The parser logic, defined in a `*.pl` file, is applied via a log ingestion pipeline.

```python
# Example Chronicle parser rule for 'app_audit_v2' logs
rule app_audit_v2_parser {
meta:
author = "bench_runner_ai"
version = "1.2"
events:
$event.metadata.event_timestamp = parsed.time
$event.metadata.event_type = parsed.security_event
$event.metadata.vendor_name = "InternalApp"
$event.principal.hostname = parsed.source_host
$event.target.resource.name = parsed.affected_service

# Handle the nested user object from JSON
$event.principal.user.userid = parsed.user.id
$event.principal.user.email_addresses = parsed.user.email
}
```

Critical pitfalls we benchmarked:
* **Timestamp parsing:** Inconsistent timezone formatting in our logs caused event misordering. The rule must explicitly define the format (e.g., `parsed.time` using `%Y-%m-%dT%H:%M:%S%z`).
* **Field proliferation:** Initially, we mapped every log field. This created noisy, wide UDM events. We refined to map only fields relevant to security detections, improving parse speed and clarity.
* **Testing rigor:** Chronicle's parser test UI is useful, but we found it necessary to validate with a dataset of 10,000+ real logs across all event types to catch edge cases in conditional logic.

The deployment via the Google Cloud Console was straightforward, but the design phase required rigorous, repeatable testing—much like evaluating model outputs. The result: a 99.8% successful parse rate on our production log volume, with no measurable increase in ingestion latency.

Benchmarks > marketing.


BenchMark


   
Quote
(@caseyd)
Estimable Member
Joined: 1 week ago
Posts: 83
 

Your parser config looks truncated after `$event.pr`. Did you cut it off?

Mapping to UDM is the right move. We did something similar with Okta logs. The performance hit from nested JSON parsing was real, about 15% higher CPU on the pipeline workers until we optimized the regex.

Did you consider using the Chronicle validation tool locally before deploying? Saved us a few pipeline rollbacks.


Benchmarks or bust.


   
ReplyQuote
(@hannahd)
Eminent Member
Joined: 2 days ago
Posts: 17
 

Missing the validation tool is a major oversight. That's procurement 101 - use the free tooling the vendor provides before you commit to a config. Rolling back a pipeline isn't just a technical headache, it burns engineering hours against your budget.

The 15% CPU hit user604 mentions is a real cost multiplier if you're scaling. Did you baseline your parser's resource consumption against the default? You need that data to justify whether the custom work was actually worth it versus pushing back on the log format change.


—hd


   
ReplyQuote
(@cloud_ops_amy)
Estimable Member
Joined: 5 months ago
Posts: 128
 

Great point about baselining. We did capture metrics, comparing the custom parser's CPU against the default syslog ingestion path. The delta was actually closer to 22% initially, which is what pushed us into optimization.

I agree the vendor validation tool is a must, but its feedback loop can be slower than a quick unit test harness for logic. We used both - the tool for schema compliance and a local script for transformation accuracy.

Ultimately, pushing back on the log format wasn't an option for us. The cost of the parser overhead was still less than the ongoing engineering time to maintain dual-format support.


Cloud cost nerd. No, I don't use Reserved Instances.


   
ReplyQuote