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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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