Splunk Search

How to multiply one event value by another event value?

Thail
Explorer

Might be simple, but i run a search for tags and values and i get the information. What is the proper syntax to multiply one event value by another event value?

Thanks in advance.

Labels (1)
Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

There isn't one.  Events are treated separately so Splunk can't work with values from different events.  Exceptions exist for certain functions (range, for instance) in aggregating commands.

Tell us more about the problem you're trying to solve and perhaps we can suggest a solution.

---
If this reply helps you, Karma would be appreciated.

Thail
Explorer

Thail_0-1645813312583.png

I just want to be able to multiply these two values without needing to do it at the PLC level

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Those two events will have to be combined into a single event so Splunk can "see" both values at the same time and work with them.  One problem, however, is there appears to be nothing in common between the events that would tell Splunk they should be joined.  Can you elaborate on the use case, please?

---
If this reply helps you, Karma would be appreciated.

Thail
Explorer

Only 2 tags from the plc to multiply to get "production per hour"

0 Karma

richgalloway
SplunkTrust
SplunkTrust

If there are only 2 results then this should do the job.

index=foo Tag="Twin_PLC.Twin_PLC.Global.ProdTrend"
| rename Value was ProdTrend
| appendcols [ index=foo Tag="Board Edger.Edger_PLC.Global.DailyBlkAvg" | rename Value as DailyBlkAvg ]
| eval product=ProdTrend * DailyBlkAvg
| table ProdTrend DailyBlkAvg product

If there are more than 2 results then Splunk will need to know how to pair them so the calculations are accurate.

---
If this reply helps you, Karma would be appreciated.
0 Karma

Thail
Explorer

this one didnt quite work...

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I can't see your screen from here so you'll have to write down what results you got and what results you expected to get.

---
If this reply helps you, Karma would be appreciated.
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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...