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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...