I had a customer recently ask how to change the host that was applied to a particular set of incoming events. Normally this wouldn’t be a big deal, just specify the new name in inputs.conf. But this is from syslog. When you set one of the syslog sourcetypes there is some extra processing to extract the correct hostname which overrides other settings. And the hostname in the event is wrong.
So to get the right one, I set up this transform to force it to a specified value. And still give it my correct syslog sourcetype.
My inputs.conf is tailing an entire directory, which for sake of demonstration I’m going to pretend is all syslog.
$ more inputs.conf host = support09.splunk.com [tail:///var/log] disabled = false host = support09.splunk.com sourcetype = syslog
props.conf is specifying a transform only for the source of interest:
$ more props.conf # note: overriding default syslog transform! TRANSFORMS = feorlenhost
and transforms.conf is defining what to do to it. I have to specify a REGEX, but I’m not actually using it so I’ll just say ‘.’ to match everything. The FORMAT line is what is going to set my host:
$ more transforms.conf [feorlenhost] DEST_KEY = MetaData:Host REGEX = . FORMAT = host::feorlenhost.splunk.com
So whatever syslog put in there for host, ignore and use my static value instead.
The Splunk platform removes the barriers between data and action, empowering observability, IT and security teams to ensure their organizations are secure, resilient and innovative.
Founded in 2003, Splunk is a global company — with over 7,500 employees, Splunkers have received over 1,020 patents to date and availability in 21 regions around the world — and offers an open, extensible data platform that supports shared data across any environment so that all teams in an organization can get end-to-end visibility, with context, for every interaction and business process. Build a strong data foundation with Splunk.