Splunk Search

REX Question

subtrakt
Contributor

Hi

rex "(?i)\].*(?<test1>([^ ]* ){5})"  

I want to avoid numbers being returned but i don't want to avoid the results with numbers in them.

I'm thinking i need to put this in the regex somewhere but haven't had any luck so far.

\D+ or [^0-9]  
Tags (2)
0 Karma
1 Solution

tom_frotscher
Builder

Hi,

here is a run everywhere example, just copy and paste it in your splunk search bar. Is this what you want?

| stats count | eval line="2014-11-14 12:52:59:[ INFO]:- batman.java1 length of 25 error :0:" | rex field=line max_match=0 "(?<test1>[a-zA-Z]+)" | mvcombine test1

View solution in original post

jrodman
Splunk Employee
Splunk Employee

Is the goal here to match terms that have a minimum of one alpha character?

What about something like (\w*[A-Za-z]+\w*)

0 Karma

tom_frotscher
Builder

Hi,

here is a run everywhere example, just copy and paste it in your splunk search bar. Is this what you want?

| stats count | eval line="2014-11-14 12:52:59:[ INFO]:- batman.java1 length of 25 error :0:" | rex field=line max_match=0 "(?<test1>[a-zA-Z]+)" | mvcombine test1

subtrakt
Contributor

Thanks. What is the mvcombine doing?

0 Karma

tom_frotscher
Builder

The rex command extracts multiple words from the string and puts them into the field test1. Because there are multiple values, the field then is a so called multi value field. Mvcombine transforms mvfields to normal fields.

0 Karma

subtrakt
Contributor

Sure,

2014-11-14 12:52:59:[ INFO]:- batman.java1 length of 25 error :0:

For above scrape 45, 25 and 1 from the field result and have it look like this

"batman.java length of error"

0 Karma

subtrakt
Contributor

The query needs to be a catch all for multiple log types like Cisco juniper and Unix

0 Karma

aljohnson_splun
Splunk Employee
Splunk Employee

Just post a few single events from a few different types, and specify what you're trying to extract. Otherwise this question is pretty much impossible to answer with any confidence.

0 Karma

cpetterborg
SplunkTrust
SplunkTrust

Can you provide some example events and what you want to extract from them?

0 Karma

aljohnson_splun
Splunk Employee
Splunk Employee

Can you give an example of the data you're matching against ?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...