Hello everyone,
I'm facing an inconsistent parsing issue while ingesting JSON events through HEC and I'd appreciate any guidance.
I'm trying to:
The sourcetype assignment works perfectly, but the dynamic source assignment only works for approximately 80-90% of the events. The remaining 10-20% keep the original source instead of being updated.
transforms.conf
[set_source_from_evt]
REGEX = .+\"evt\"\s*:\s*\{[\s\S]*?\"name\"\s*:\s*\"([^\"]+)\".+
FORMAT = source::$1
DEST_KEY = MetaData:Source
[set_datadog_sourcetype]
REGEX = .
DEST_KEY = MetaData:Sourcetype
FORMAT = sourcetype::datadog:auditprops.conf
[json"] TRANSFORMS-fix_sourcetype = set_datadog_sourcetype, set_source_from_evt
I also tried applying the transform after changing the sourcetype:
[datadog:audit] TRANSFORMS-set_source = set_source_from_evt
but the behavior remained exactly the same.
For example, the following fragment should produce:
source = Synthetics Monitoring
because it contains:
"tags":["public_id:ec8-knz-4bv","version:4"],"evt":{"name":"Synthetics Monitoring","actor":{"type":"USER"}}},"message":However, some events containing this structure still keep the original source.
Has anyone experienced inconsistent behavior when setting MetaData:Source using a transform during HEC ingestion?
Is there any known limitation regarding:
Any ideas or suggestions would be greatly appreciated.
Thanks!
Hi @luispulido
The inconsistency could be caused by the default LOOKAHEAD limit in transforms.conf. By default, Splunk only searches the first 4096 bytes of an event during index-time regex matching. If the "evt" block or "name" key is located beyond this limit in larger JSON payloads, the transform fails silently and retains the original source.
Add the following to your transforms stanza:
LOOKAHEAD=10000
# Or higher if required🌟 Did this answer help you? If so, please consider:
Your feedback encourages the volunteers in this community to continue contributing.
You should check whether the events that fail are being truncated or parsed differently before the transform runs. Even if the regex works, rex, index-time transforms only see the raw event at ingestion, so settings like TRUNCATE, LINE_BREAKER, or INDEXED_EXTRACTIONS can affect the result.
Also enable parsing debug logs to confirm whether set_source_from_evt is actually matching those events or being skipped. If the same event sometimes works and sometimes doesn't, that points more toward the ingestion pipeline than the regex itself. If everything looks correct, it may be worth opening a Splunk support case, as inconsistent MetaData:Source transforms during HEC ingestion aren't expected.
Hi @luispulido
The inconsistency could be caused by the default LOOKAHEAD limit in transforms.conf. By default, Splunk only searches the first 4096 bytes of an event during index-time regex matching. If the "evt" block or "name" key is located beyond this limit in larger JSON payloads, the transform fails silently and retains the original source.
Add the following to your transforms stanza:
LOOKAHEAD=10000
# Or higher if required🌟 Did this answer help you? If so, please consider:
Your feedback encourages the volunteers in this community to continue contributing.