Dashboards & Visualizations

Extract json array to tabular format with their values

nithys
Communicator

Hi 

I have an event which has prod and test based on env...if it is test it goes to nsps [{},{} ] object an check for the name say A,B,C,D an get their associate  ReadOnlyConsumerNames in tabular format

Output as:

Name      ReadOnlyConsumerNames 
A               Application, Lst,data

B               Application, Lst

C             Lst

D            Lst,Gt,PT

 

 

 

{ [-]

   prod: { []

   }

   test: { [-]

     DistinctAdminConsumers: [ [-]

       App

       pd.

     ]

     DistinctAdminUser: 2

     DistinctReadConsumers: [ [-]

       Application.

       GT.

       Technology.

       data

     ]

     DistinctReadUser: 4

     TotalAdminUser: 20

     TotalNSPCount: 10

     TotalReadUsers: 13

     nsps: [ [-]

       { [-]

         AdminConsumerNames: [ [-]

           App.

           pd.

         ]

         AdminUserCount: 2

         Name: A

         ReadOnlyConsumerNames: [ [-]

           Application

           Lst

           data

         ]

         ReadonlyUserCount: 3

       }

       { [-]

         AdminConsumerNames: [ [-]

           App

           Data

         ]

         AdminUserCount: 2

         Name: B

         ReadOnlyConsumerNames: [ [-]

           Application

           Lst

         ]

         ReadonlyUserCount: 3

       }

       { [-]

         AdminConsumerNames: [ [-]

           preprod

           pd

         ]

         AdminUserCount: 2

         Name: C

         ReadOnlyConsumerNames: [ [-]

           Lst

         ]

         ReadonlyUserCount: 1

       }

       { [-]

         AdminConsumerNames: [ [+]

         ]

         AdminUserCount: 2

         Name: D

         ReadOnlyConsumerNames: [ [-]

           Lst

           Gt

           PT

         ]

         ReadonlyUserCount: 1

       }

  

     ]

   }

}

 

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| spath test.nsps{} output=nsps
| mvexpand nsps
| spath input=nsps Name output=Name
| spath input=nsps ReadOnlyConsumerNames{} output=ReadOnlyConsumerNames
| table Name ReadOnlyConsumerNames
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Keep the Learning Going with the New Best of .conf Hub

Hello Splunkers, With .conf26 getting closer, there’s already a lot of excitement building around this year’s ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

How to find the worst searches in your Splunk environment and how to fix them

Everyone knows Splunk is a powerful platform for running searches and doing data analytics. Your ...