Splunk Search

Regex Hostname from log file name

conner9
Path Finder

I am trying to extract the hostname from the name of the file selected as input.

For input setup I have the following:
Set Host = regex on path
Regular Expression = _([^_]+).log$

Whitelist = *\.log$

file names and path look like this: (this is an nfs mounted share)

/dev/data/runs/int_master__int_master_2012_03_20_15_48_39/logs/target_diag_manager_xray_int0001.log

int0001.log is my hostname, but Splunk keeps flagging the hostname as dev0001, the splunk indexer, as the hostname.

Suggestions, thoughts?

Tags (1)
0 Karma

Jeremiah
Motivator

I don't think your regex is correct. Maybe try ([^/_]+).log$ instead?

conner9
Path Finder

Thanks a lot that did the trick. Now it's grabbing exactly what I wanted.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...