Hi,
I would like to extract two new fields from the value of the host field at search time. I'd like the first 3 characters of the host field value to be a new field named 'group', and the next 3 characters of the host field value to be a new field named 'site'.
e.g.
if
host = AAABBBsomestring
then
group = AAA
site = BBB
I believe I have the regex to make this work. I've tested it with rex in a Splunk Search & can see the new fields 'group' & 'site' being correctly populated in the events resulting from that rex modified search.
Here is my search:
index=mjtest | rex field=host "(?<group>\w{3})(?<site>\w{3})\w+"
So I then tried to place this as an inline field extraction in props.conf.
My environment for testing is a single virtual machine hosting all splunk functions including search head & indexers. Additionally the files being monitored are also on this same test server. All config files named below are in my own app in SPLUNK_HOME/etc/apps/app_name/local.
My inputs.conf looks like:
[monitor:///path/to/file/*/child_*.log]
index=mjtest
sourcetype=mjtest
host_regex = /path/to/file/.*/child_(\w+).log
My props.conf looks like:
[mjtest]
EXTRACT-group,site = (?<group>\w{3})(?<site>\w{3})\w+ in host
However these fields are not extracted at search time, well they don't appear in the event data or the list of interesting fields in a Splunk Search.
Any clues on why this might be? Is it because I'm setting the host value via host_regex in inputs.conf? I would have thought that wouldn't matter as that would happen before any props.conf actions took place in the processing pipeline.
For what it's worth I also tried doing a REPORT extraction with a props.conf & transforms.conf combo of the below which also didn't work.
props.conf:
[sourcetype::mjtest]
REPORT-fieldextract = group_site_extract
transforms.conf:
[group_site_extract]
REGEX = (?<group>\w{3})(?<site>\w{3})\w+
SOURCE_KEY = host
Ultimately I don't mind which way my goal is achieved... but it's driving me crazy why it's not working.
Any help would be much appreciated.
Michael.
... View more