Splunk Search

Alternative for eval while using pivot

sushmitha_mj
Communicator

I wanted to accelerate my searches so I am using data models and pivot.

| pivot Accounting Accounting  sum(Input) AS "Input" sum(Output) AS "Output" dc(User_Name) AS "Distinct Count of User_Name" SPLITROW _time AS _time PERIOD hour SORT 100 _time ROWSUMMARY 0 COLSUMMARY 0 NUMCOLS 0 SHOWOTHER 1 

I want to do a simple sum(Input)/10000 as "input" (Division by 10000) that's all.
I tried using stats before the sum and also eval, but it does not work on a pivot. How can I do this?

Tags (2)
1 Solution

alacercogitatus
SplunkTrust
SplunkTrust

I don't currently have a way to test this, but if it behaves like the timechart command, you should be able to do this:

| pivot Accounting Accounting  sum(eval(Input/1000))  AS "Input" sum(Output) AS "Output" dc(User_Name) AS "Distinct Count of User_Name" SPLITROW _time AS _time PERIOD hour SORT 100 _time ROWSUMMARY 0 COLSUMMARY 0 NUMCOLS 0 SHOWOTHER 1 

View solution in original post

alacercogitatus
SplunkTrust
SplunkTrust

I don't currently have a way to test this, but if it behaves like the timechart command, you should be able to do this:

| pivot Accounting Accounting  sum(eval(Input/1000))  AS "Input" sum(Output) AS "Output" dc(User_Name) AS "Distinct Count of User_Name" SPLITROW _time AS _time PERIOD hour SORT 100 _time ROWSUMMARY 0 COLSUMMARY 0 NUMCOLS 0 SHOWOTHER 1 

emoyoun
New Member

I downvoted this post because i tried the same and it didn't work for me.

0 Karma

ppablo
Retired

Hi @emoyoun

Please reserve downvoting for answers and suggestions that could potentially be harmful for a Splunk environment, not just because something didn't work for you. as this solution can be useful for other users. Please review how voting etiquette works in the Splunk community and this forum before further engaging in the forum.
https://answers.splunk.com/answers/244111/proper-etiquette-and-timing-for-voting-here-on-ans.html

0 Karma

emoyoun
New Member

I tried this and it didn't work.
| pivot Statistics HTTP sum(eval(count/3600)) AS "Total Number of Transactions"

I get this error:
Error in 'PivotCell': The object 'HTTP' has no field 'eval(count/3600'.

Any ideas??

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!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...