Splunk Search

Variable storage

Kendrick33
Explorer

I am performing some math functions in splunk.I am doing a search that will calculate the percentage of each data type. What variable can I use to store values without them having to be charted until the end of my search.

For example:

chart avg(db_abc_p) as anr, avg(db_efg) as enr, avg(db_hij) as hnr, avg(db_total) as Total | eval percentANR=(anr/Total)*100 | eval percentENR (enr/Total)*100 | eval percentHNR=hnr/Total)*100

what I end up with is valueS outputed for all seven variables, when all I really want is to display the values for : percentANR, percentENR, percentHNR

Tags (1)

sfleming
Splunk Employee
Splunk Employee

or... for a simple table display,

... | table percentANR, percentENR, percentHNR

The table command will output the columns in the order you specify.

southeringtonp
Motivator

Use the fields command to limit the display to just those you want to keep:

| fields percentANR, percentENR, percentHNR

gkanapathy
Splunk Employee
Splunk Employee

Or ... | fields - unwantedfield to remove specific fields.

0 Karma
Get Updates on the Splunk Community!

Splunk Platform | Upgrading your Splunk Deployment to Python 3.9

Splunk initially announced the removal of Python 2 during the release of Splunk Enterprise 8.0.0, aiming to ...

From Product Design to User Insights: Boosting App Developer Identity on Splunkbase

co-authored by Yiyun Zhu & Dan Hosaka Engaging with the Community at .conf24 At .conf24, we revitalized the ...

Detect and Resolve Issues in a Kubernetes Environment

We’ve gone through common problems one can encounter in a Kubernetes environment, their impacts, and the ...