Splunk Search

Is it possible to use an extracted field inside a regex?

edrivera3
Builder

Hi

I already extracted a field (block_num) in my event, but now I would like to use it as part of a new regex. I want to do something like this:
...| rex field=_raw " Block number block_num (? < block_info>\w{1,}?)" ---- where block_num is the field I already have.

0 Karma

stephanefotso
Motivator

No No No !
By writing ...| rex field=_raw " Block number block_num (? < block_info>\w{1,}?)", your are telling splunk to search for a word which is after the group of words Block number block_num. Splunk will not take block_num here as a field.
So i am not sure that what you want is yet possible.

SGF
0 Karma

edrivera3
Builder

I know the regex is wrong, I would like to know if there is a way to do it.

0 Karma

stephanefotso
Motivator

No! you can only take block_num as a word inside the regex. Let me know block_num values, i think i can help you extract block_info

SGF
0 Karma

edrivera3
Builder

It is a 3-5 digit number.

0 Karma

edrivera3
Builder

Before the w there is a back slash.

0 Karma

edrivera3
Builder

I already tried enclosing the block_num in [ ] or in $$.

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, ...