Splunk Search

Regular expression in Search

JensT
Communicator

Hello,

i want all records from some hosts.

How can i find records from hosts that match: host=chvj[34]04ld8[246] ?

Cheers,

Jens

Tags (1)

ziegfried
Influencer

The best solution would be to use a subsearch for this purpose:

* [ | metadata type=hosts | regex host="chvj[34]04ld8[246]" | fields host ]

Alternatively you could search for all events and filter based on the regex:

* | regex host="chvj[34]04ld8[246]"

JensT
Communicator

The second search is not suitable in our environment as we produce to much events.

But the first search seems to be okay. (not nice, tough)

Thanks,

Jens

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...