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

New Year. New Skills. New Course Releases from Splunk Education

A new year often inspires reflection—and reinvention. Whether your goals include strengthening your security ...

Splunk and TLS: It doesn't have to be too hard

Overview Creating a TLS cert for Splunk usage is pretty much standard openssl.  To make life better, use an ...

Faster Insights with AI, Streamlined Cloud-Native Operations, and More New Lantern ...

Splunk Lantern is a Splunk customer success center that provides practical guidance from Splunk experts on key ...