Splunk Search

How do I perform eval function on chart values?

Romeo_James
Engager

Example Search:
Index=*
|chart count over Character
|addcoltotals

Example output:

Char ........Count

A.................21
B.................13
C.................54
D.................11
....................99


Is it possible to take the addcoltotals and divide it by the value of C (54/99) using an eval func?

0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@Romeo_James ,

Try,

    index=*
   |chart count over Character
   |eventstats sum(count) as Total
   |addcoltotals
   |eval X=if(Character=="C",count/Total,"")|fields - Total

You can remove the condition, if you want the values for all characters

Happy Splunking!

View solution in original post

renjith_nair
SplunkTrust
SplunkTrust

@Romeo_James ,

Try,

    index=*
   |chart count over Character
   |eventstats sum(count) as Total
   |addcoltotals
   |eval X=if(Character=="C",count/Total,"")|fields - Total

You can remove the condition, if you want the values for all characters

Happy Splunking!
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...