Splunk Search

Percentage on field summary values

msrama5
Explorer

Hello, I am trying to do percentage on fieldsummary values , following is the query and results for the query -

index=_* OR index=* sourcetype=OPENAPI_ACCERTIFYSECUREGATEWAY  Details.RawRequest.transactionType=Reload | fieldsummary maxvals=3 *Details.RawRequest* | where (values like "%Empty%" OR values like "%Present%" OR isnull(values)) | fields - is_exact, max , mean, min, numeric_count, stdev, distinct_count | sort -  num(count)

field                       count   values
postalCode                  53093   [{"value":"*** (Present) ***","count":53089},{"value":"*** (Empty) ***","count":4}]
countrySubdivision          52974   [{"value":"*** (Present) ***","count":52966},{"value":"*** (Empty) ***","count":8}]
address.phone               38069   [{"value":"*** (Present) ***","count":37675},{"value":"*** (Empty) ***","count":394}]

I need the percentage on present vs empty values in values field results above , any ideas how can this be done ?

0 Karma

cmerriman
Super Champion

If you were to write up a regex to extract the number of present values and do an eval to calculate the percentage, I think that’s what you’re looking for.

I’m on mobile, so bear with me right now. Something like:

|rex field=values "\(Present\) \*\*\*\",\"count\":(?<present_count>/d+)"|eval perc_present=(present_count/count)*100

Might need some tweaking.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

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 GA in US-AWS!

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