Getting Data In

Route syslog UDP data to specific index and sourcetype

phoenixdigital
Builder

Simple task and I am sure I am close here.

A UDP port is open on a heavy forwarder and data is coming in to source udp:514

Now at present there is only one type of data arriving here but as time progresses we will be sending different sourcetypes to this port.

I am trying to detect the data as it arrives and assign a sourcetype and index. The sourcetype reassingment is working but the index reassignment is not.

Configs on the heavy forwarder below.

inputs.conf

[udp://514]
connection_host = ip
sourcetype = hf:syslog
index = test_data

props.conf

[source::udp:514]
TRANSFORMS-1force_sourcetype = force_sourcetype_asa,force_sourcetype_for_pix,force_sourcetype_for_fwsm
TRANSFORMS-2index_routing = syslog_index_routing

I tried reordering the TRANSFORMS swapping 1 and 2 around but no joy.

transforms.conf

[force_sourcetype_for_asa]
DEST_KEY = MetaData:Sourcetype
REGEX = %ASA-\d-\d{6}
FORMAT = sourcetype::fw:asa:log

[force_sourcetype_for_fwsm]
DEST_KEY = MetaData:Sourcetype
REGEX = %FWSM-\d-\d{6}
FORMAT = sourcetype::fw:fwsm:log

[force_sourcetype_for_pix]
DEST_KEY = MetaData:Sourcetype
REGEX = %PIX-\d-\d{6}
FORMAT = sourcetype::fw:pix:log

[syslog_index_routing]
SOURCE_KEY = MetaData:Sourcetype
DEST_KEY = MetaData:Index
REGEX = fw:asa:log
FORMAT = sec_firewall

Tired this but it didn't work either
FORMAT = index::sec_firewall

Any hints?

I know I am close.

0 Karma
1 Solution

crash1011
Explorer

You were very close!

The Index setting (as opposed to say Sourcetype or Host) requires the MetaData command to be preceded by an underscore e.g.

DEST_KEY = _MetaData:Index,

View solution in original post

crash1011
Explorer

You were very close!

The Index setting (as opposed to say Sourcetype or Host) requires the MetaData command to be preceded by an underscore e.g.

DEST_KEY = _MetaData:Index,

phoenixdigital
Builder

Thanks for that.

Weird/annoying that the configs are so inconsistent.

0 Karma

phoenixdigital
Builder

Secondary question is this bad practice to send many different sourcetypes to the same UDP syslog port?

Is it better to say listen on port

514
515
516
.....

Then have a unique sourcetype going to each port.

This obviously wont work if the device sending the logs cannot use custom ports.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

How to find the worst searches in your Splunk environment and how to fix them

Everyone knows Splunk is a powerful platform for running searches and doing data analytics. Your ...

Share Your Feedback: On Admin Config Service (ACS)!

Help Us Build a Better Admin Config Service Experience (ACS)   We Want Your Feedback on Admin Config Service ...

Build the Future of Agentic AI: Join the Splunk Agentic Ops Hackathon

AI is changing how teams investigate incidents, detect threats, automate workflows, and build intelligent ...