Splunk Search

How can I sum the numeric value in one field after doing field extraction?

quangva
New Member

My event like this:

_time,ProductA,2,"318"
_time,ProductA,5,"318"
_time,ProductA,3,"318"

Extracted fields are:

Time, Product, Qty, Price

I need to sum Qty field as Total for this example 10

0 Karma
1 Solution

vnravikumar
Champion

Hi

Try

your query..|stats sum(Qty) as Total

View solution in original post

0 Karma

vnravikumar
Champion

Hi

Try

your query..|stats sum(Qty) as Total
0 Karma

quangva
New Member

Yeah, it get right result. But Price is not if we do the same. Do we need to convert string to numberic?

0 Karma

vnravikumar
Champion

Its in doble quotes considered as string.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...