Splunk Search

How do I rename a Rex field?

sid_1435
Explorer

Hi , 

I want to rename to Required Parameters Longitude and Latitude are missing or invalid to a new value Required Parameters missing.

 

index="****" k8s.namespace.name="*****" "Error" OR "Exception" | rex field=_raw "(?<error_msg>Required Parameters Longitude and Latitude are missing or invalid)" | stats count by error_msg | sort count desc

 

Any help will be great

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval error_msg=if(match(_raw, "Required Parameters Longitude and Latitude are missing or invalid"),"Required Parameters missing", error_msg)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eval error_msg=if(match(_raw, "Required Parameters Longitude and Latitude are missing or invalid"),"Required Parameters missing", error_msg)

sid_1435
Explorer

Hi Again,

I have the drilldown on the field 

Required Parameters Longitude and Latitude are missing or invalid

But since we have renamed  it to 

Required Parameters missing

it is sending  renamed value as parameter , rather i want the original value as parameter

Can you please suggest how to do that 

 

Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Add a condition to the drilldown so that if the value is "Required Parameters missing" change it to "Required Parameters Longitude and Latitude are missing or invalid" in the drilldown action

sid_1435
Explorer

Thanks , 

It worked

0 Karma

diogofgm
SplunkTrust
SplunkTrust

Use | rex with SED mode

 

| makeresults
| eval error_msg = "Required Parameters Longitude and Latitude are missing or invalid"
| rex field=error_msg mode=sed "s/(Required Parameters) .* (missing) .*/\1 \2/g"

 

 

 

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...