Getting Data In

How do I set hostname without syslog

I_am_Jeff
Communicator

I have a UF sending logs to my indexer. The UF receives logs, via syslog, from several other systems. All my UFs, indexers, and search heads are Splunk 4.2.3 and running Red Hat Linux. The logs go to a custom index, not main.

I'd like to extract the hostname from the events so I can search for host=hostname. I know the hostname is between AB: and the next colon, and believe I have the regex to do that. I believe I have to do this on the indexers.

 2012-01-13 16:05:44,528 weblogic:[ExecuteThread: '20' for queue: 'webapp.queue']AB:hostname:1234567:autofoo

I've done this on a standalone implementation where the log is written to a file by syslog, but how do I do it with forwarders, multiple indexers and search heads? Right now host= the name of the UF box, not the "correct" hostnames.

0 Karma
1 Solution

Damien_Dallimor
Ultra Champion

You could perform an index time transform on the host field.
Add entrys to props.conf and transforms.conf in the "local" directory for the app on the Universal Forwarder.My regex example is a bit generic, you might want to tighten it up a bit based on the actual patterns in your logs.

#props.conf
[my_sourcetype]
TRANSFORMS-host = my_sourcetype_host

#transforms.conf
[my_sourcetype_host]
DEST_KEY = MetaData:Host
REGEX = ^.+AB:(\w+):\d+:\w+
FORMAT = host::$1

View solution in original post

Damien_Dallimor
Ultra Champion

You could perform an index time transform on the host field.
Add entrys to props.conf and transforms.conf in the "local" directory for the app on the Universal Forwarder.My regex example is a bit generic, you might want to tighten it up a bit based on the actual patterns in your logs.

#props.conf
[my_sourcetype]
TRANSFORMS-host = my_sourcetype_host

#transforms.conf
[my_sourcetype_host]
DEST_KEY = MetaData:Host
REGEX = ^.+AB:(\w+):\d+:\w+
FORMAT = host::$1

Damien_Dallimor
Ultra Champion

regex = ^.+(?:AB|CD):(\w+):\d+:\w+

Yep , the files get deployed to the UF.

0 Karma

I_am_Jeff
Communicator

Working on getting this implemented using a Deployment Server. The regex needs some work as I have an AB: or CD: situation. (That shouldn't be a big deal.) The props.conf and transforms.conf go on the UF, huh, not on the indexer? $SPLUNK_HOME/etc/apps/jeff/local/{props.conf|transforms.conf}

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...