Getting Data In

How to add constant to HOST name using regular expression

neilli
Engager

I am using a reg-exp to set the host name from the file path
e.g. \servername\logs\application\ag_clientname_log
monitor \servername\logs\application\ag_*
host_regex = (ag_[^_]+)
this gives me "ag_clientname" but I want "clientname_ag_logs" to match what we had previously been collecting.

0 Karma

woodcock
Esteemed Legend

There is no way to do this that I know. I would create a link to each file in a different directory and give each the link the correct name and point the monitor to the other directory. This consumes NO extra disk space (only 1 inode per file).

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi
You could use also eval
| eval host=substr(host,4,15)+"_ag_logs"

Bye
Giuseppe

Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...