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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...