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
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...