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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Rounding off the Splunk Dashboard Contest

What does a contest-winning Splunk dashboard look like? In this case, it isn't in a browser tab at all. It ...