Dashboards & Visualizations

Why am I unable to get the exact rex output?

Nagalakshmi
Path Finder

Hi Team,

We are trying to extract the hostname from the logs . but unable to get the exact output ( we need hostname as sample-987) . Please find the logs and tried command. Please assist us on high priority. Thanks

logs:-
 Symptom: type DD Alert Sample-987: CRITICAL: DiskFailure: HardwareFailure

Our Command:-
| rex field=_raw "DD\s\Alert\s(?<HostName>\w+-\d+)"


Regards,
Lakshmi 

Labels (1)
Tags (2)
0 Karma
1 Solution

Nagalakshmi
Path Finder

Hi @isoutamo ,

Thank you for your help! We got the expected output by using the below mentioned command.

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You don't need the backslash before the A (\A asserts position at start of the string)

isoutamo
SplunkTrust
SplunkTrust

Hi

can you try this

 

| rex "DD Alert (?<HostName>[^:]+)"

 

r. Ismo

fixed: removed unnecessary escape characters.

Nagalakshmi
Path Finder

Hi @isoutamo ,

Thank you for your help! We got the expected output by using the below mentioned command.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...