Splunk Search

How to create pie chart for two fields?

Dharani
Path Finder

Hi,

 

I have service name verb, object and outcome. I need to show the statistics in pie chart. 

For example,

index=abc (SUBJECT="Access"  AND OBJECT="status" AND VERB="Get") OR (SUBJECT="Customer Service" AND VERB=Get AND OBJECT="Customer status") OR (SUBJECT="Agreement service" AND OBJECT="attachments" AND VERB="Create") 
| search OUTCOME=FAILURE
| chart count by VERB,OBJECT

 

Results:

VERB                     Customer status              attachments

Get                                  3                                            0

Create                            0                                             2

 

What I am looking for is to show that 2 failures for create attachments and 3 failures for get customer status in Pie Chart format. But above query is not working like that , it is only showing one field in the pie chart which is not use ful.

 

Please help on this.

Thanks in Advance.

Labels (4)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

By definition, pie chart visualizes a one-dimensional function.  When you use two fields in groupby, that creates a two-dimensional function.  Drop OBJECT.

index=abc (SUBJECT="Access"  AND OBJECT="status" AND VERB="Get") OR (SUBJECT="Customer Service" AND VERB=Get AND OBJECT="Customer status") OR (SUBJECT="Agreement service" AND OBJECT="attachments" AND VERB="Create") 
| search OUTCOME=FAILURE
| chart count by VERB

The caveat is that you must have positive knowledge that OBJECT and VERB are diagonal as your illustrated data show.  Otherwise you need to assess whether the results still suite your need.

Hope this helps.

0 Karma

Dharani
Path Finder

Hi,

Thanks for this , but only having VERB in pie chart will not help for my case.

Is there any possibility to join VERB and OBJECT to a single field and make that field in chart command.

 

Example,

VERB=get OBJECT=customer status

new_field="get customer status"

IN query:

chart count by new_field.

Please let me know if this is possible.

Thanks!

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Yes, string concatenation can be used to flatten a vector when data are not strictly diagonal.

index=abc (SUBJECT="Access"  AND OBJECT="status" AND VERB="Get") OR (SUBJECT="Customer Service" AND VERB=Get AND OBJECT="Customer status") OR (SUBJECT="Agreement service" AND OBJECT="attachments" AND VERB="Create") 
| search OUTCOME=FAILURE
| eval verb_object = VERB . " " . OBJECT
| chart count by verb_object

Dharani
Path Finder

Thanks it works

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...