Splunk Search

how to remove few content from splunk output

avi123
Explorer

Hi All,

I have a splunk query giving results in this format:
Time                                                             Event
3/10/25 10:52:15.000 AM                 { [-]
                                                                         BCDA_AB_CD_01: 1
                                                                         BCAD_AB__02: 0
                                                                         BCDA_AB_DC: 1
                                                                         BCAD_CD_02: 0
                                                                        }

However I want to remove the BCAD_AB__02 and BCAD_CD_02 from the output. Please help me write a splunk query to exclude these two values from the output. I tried doing  | fields - BCAD_AB__02 BCAD_CD_02 
but this didn't work

Labels (1)
Tags (1)
0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @avi123 

How about this?

You can remove the fields as you are doing, then do | tojson

livehybrid_0-1741618484879.png

 

Here is a sample SPL

| makeresults 
| eval _raw=json_extract("{\"BCDA_AB_CD_01\": 1, \"BCAD_AB__02\": 0, \"BCDA_AB_DC\": 1, \"BCAD_CD_02\": 0}","")
| spath input=_raw
| fields - BCAD_CD_02 BCAD_AB__02
| tojson

Please let me know how you get on and consider adding karma to this or any other answer if it has helped.
Regards

Will

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @avi123 ,

could you share the search and the field names you're using ?

Ciao.

Giuseppe

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...