All,
I'm trying to use host_regex to extract host names for input
Background:
Aim
to get:
fihel01srv001
frpar01srv001
uklon01srv001
Attempted:
but...
when putting this into inputs.conf, it doesn't work
host field is set to the server that is indexing the logs
ie: host=splunkserver
inputs.conf:
[monitor://C:\foo\bar\Splunk\WET\.log]
disabled = false
followTail = 0
index = test
sourcetype = testlogs
crcSalt=
host_regex = ".
BTW: also open to other alternative solutions...
ok, the answer is...remove the quotes!
The following works:
host_regex =_*?([a-z]+[0-9]+[a-z]+[0-9]+)-.+\\.log$
ok, the answer is...remove the quotes!
The following works:
host_regex =_*?([a-z]+[0-9]+[a-z]+[0-9]+)-.+\\.log$
I'm not sure how many slashes, but this might work for your host_regex in inputs.conf
\\\\\([a-z]+[0-9]+[a-z]+[0-9]+)-.+.log$"
Sorry, this doesn't work, even without the quotes. Using the regex (.+), the path is prefixed with 'source:' therefore the regex will fail. The solution below.
Per
the host_regex extracts from the path, not the filename.
Alternate solution. Put each server log in it's own folder and use host_regex or easier use host_segment.
Actually, the path includes the file name, you can test this by using the following regex: (.+)