Splunk Search

How to create a timechart from calculated value?

balendra
New Member

Hello I have a search to plot the calculated value over time. However the search is not working as expected.

| eval Output1 = Value1 * 10
| eval Output2 = ((10 * (Value2)) + Output1)
| timechart span=1m values(Output2)  by host 

The above search is not plotting the Output2 value graph. If I just change the value for Output1 in eval Output2 then it works i.e.

| eval Output2 = ((10 * (Value2)) + 10)

Is there any other way to timechart calculated value?

0 Karma
1 Solution

somesoni2
Revered Legend

I would try like this

| eval Output1 = 'Value1'*10
 | eval Output2 = ((10*'Value2') + 'Output1')
 | timechart span=1m values(Output2)  by host 

The values function may give multivalued field if your data coming multiple times in a minute and nothing will be plotted. If that is the case you may want to different function here (min, max, avg, sum etc instead of values).

View solution in original post

0 Karma

somesoni2
Revered Legend

I would try like this

| eval Output1 = 'Value1'*10
 | eval Output2 = ((10*'Value2') + 'Output1')
 | timechart span=1m values(Output2)  by host 

The values function may give multivalued field if your data coming multiple times in a minute and nothing will be plotted. If that is the case you may want to different function here (min, max, avg, sum etc instead of values).

0 Karma

balendra
New Member

Since the data is coming every minute with the values function there was no data. And I changed to the below query and its working now.

| eval Output1 = 'Value1'*10
| eval Output2 = (10*'Value2')
| timechart span=1m perc90(Output2) eval(avg(Ouput1) + avg(Output2)) as total_out by host

Thanks somesoni2

0 Karma

balendra
New Member

Output1 field is numeric too.
| eval Output1 = Value1 - 10

0 Karma

asimagu
Builder

could you doublecheck the format of your fields to be numeric?

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!

Painting a Clearer Picture: Unifying Your Investigations with Cisco AI Canvas

Painting a Clearer Picture: Unifying Your Investigations with Cisco AI Canvas  We’ve all been there. You’re ...

Hello POJO, meet nocode

What's the Challenge? Instrumentation agents are highly advanced bits of software that manipulate bytecode, ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...