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
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...