Getting Data In

Forward syslog to third part based on field extraction

rjordan00
Engager

I'm evaluating Splunk for our syslog needs. One of our final requirements is to have the ability to forward syslog messages to another system. Specifically, we need to forward messages based on the source host, severity level, or event code.
I've already checked out the article on sending a subset of data to a syslog server. In the example they show how you can apply forwarding to a host in props.conf. I'd like to know how I can do this based on field extractions. For instance, I'd like to forward all messages of a severity critical or greater to my other syslog server. I can do this by defining the REGEX in transforms.conf (see below for example), but this can get kind of sloppy. I already have the field extractions defined for the sourcetypes. I just don't know how to go about using them in this scenario.

props.conf
[source::udp:514]
TRANSFORMS-syslog_forwarder = send_to_syslog

transforms.conf
[send_to_syslog]
REGEX = %\w+-[012]-\w+
DEST_KEY = _SYSLOG_ROUTING
FORMAT = my_syslog_group

outputs.conf
[syslog:my_syslog_group]
server = 192.168.100.100:514

Tags (1)
1 Solution

jbsplunk
Splunk Employee
Splunk Employee

You're limited to using the REGEX syntax as a qualifier if you want to transform the data. You can't use field extractions as a qualifier for this type of configuration.

View solution in original post

jbsplunk
Splunk Employee
Splunk Employee

You're limited to using the REGEX syntax as a qualifier if you want to transform the data. You can't use field extractions as a qualifier for this type of configuration.

jbsplunk
Splunk Employee
Splunk Employee

Sure, you could do that and it would work, or you could also combine them into a single regex and have one transform for 'syslog'. I suppose if you're going to do a lot of stuff with third party forwarding it might be cleaner to use separate transforms, but either approach would work.

props.conf

[source::udp:514]
TRANSFORMS-syslog_forwarder = syslog

transforms.conf

[syslog]
REGEX = (THIS|THAT|OTHER)
DEST_KEY = _SYSLOG_ROUTING
FORMAT = my_syslog_group

rjordan00
Engager

Thanks for the answer. On a related note, can I define multiple transforms so I can have different REGEX for different types of events I want to forward? For example, if I want to forward severity critical and higher and also a specific type of Cisco ASA event.

props.conf
[source::udp:514]
TRANSFORMS-syslog_forwarder = syslog_severity, syslog_event

transforms.conf
[syslog_severity]
REGEX = %\w+-[123]-\w+
DEST_KEY = _SYSLOG_ROUTING
FORMAT = my_syslog_group

[syslog_event]
REGEX = %ASA-5-713904
DEST_KEY = _SYSLOG_ROUTING
FORMAT = my_syslog_group

Ayn
Legend

Not sure how you imagine this would work? Field extractions take place at search-time, not index-time, so these are kind of two different things you're talking about.

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!

Mastering Threat Intelligence in ES 8.5, Splunk AI Assistant v2, and More from Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...