Splunk Search

How to edit my chart/timechart search to include the sum of events?

clintla
Contributor
sourcetype=pools

Fields- poolname, poolsize

sourcetype=poolcomponents 

Fields- componentname, poolname, componentsize, componentused, componentfree

I'd like to run something like (I know the pools field is a single event for multi poolcomponents events)

Sourcetype=pool* <-- I can see all my fields
chart sum(componentsize)/poolsize) as "Percent Pool Utilized" by poolname <-- to get a % used of the all the pools

I'd like it to be flexible where I can eventually timechart & predict these results.

Is there a simple way to do this?

0 Karma

DalJeanis
Legend

I generally like to run the records together and massage them step by step before feeding them to the charting components. Try this for any one particular pool and see if the number looks right...

sourcetype=pool* poolname="testpoolname"
| stats sum(poolsize) as poolsize, sum(componentsize) as componentsum by poolname 
| eval poolpct=componentsum/poolsize
| rename poolpct as  "Percent Pool Utilized"

In order to use a timechart, you'd have to have a time component in the data which you haven't listed. The above search isn't selecting by time, so if your records are replaced over time as the process advances, then we'd need to account for that.

I'm a bit fuzzy on the details of what you are trying to predict. Pool...components...utilized... all together suggest a construction application, or possibly a kid's party planner. If you provide more details, then we can give more salient advice.

0 Karma

clintla
Contributor

If I add up the components, I can see the total space taken up in a pool.

My device doesnt do a good job of capacity reporting & I'd like to just add up all components every day & compare them to their associated pools & calculate their usage.

Should

| eval poolpct=componentsum/poolsize
| rename poolpct as "Percent Pool Utilized"

be adding another column to the chart?

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 ...