Splunk Search

Lookup latest value in CSV or datasource

Greenwell01
New Member

Hi,
I am currently tracking my electricity usage and would like to calculate the current cost using the kWh value in Splunk. I have also created a csv value with the current cost per kWh and imported the data as a different source type with in the energy index.

I can now is to determine the usage since the beginning of the month in kWh but still need to determine the costs by multiply it with the cost shown as the latest entry of the csv file.

Any pointers?

Tags (1)
0 Karma

snoobzilla
Builder

Need more details.

Taking a guess... something like the following should work assuming you have a cost field unique to the cost data events.

search usageevent OR costevent
| eventstats last(costfield) AS CostThisPeriod
| stats sum(usage) AS usage values(CostThisPeriod) AS CostThisPeriod by customer
| eval billing=usage*CostThisPeriod
0 Karma

lguinn2
Legend

It would help if we could see the CSV file and understand the field headings...

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...