Dashboards & Visualizations

How to plot sums from a multisearch over time

cindygibbs_08
Communicator

Hi Everyone I hope everyone is having a great day 

 

I need to calculate the sum over two different indexes and then plot it by week or month... I have been trying to do the following :

1) first I calculate the total sum of my interest suing this SPL

| multisearch
[ | search index=TRAVELS AND STATUS IN ("OK", "CHECKED", "ABORD") AND CLIENT_TYPE="vip" AND ID=*
| fields ID]
[ | search index=tv_int_ang AND STATUS IN ("BOOKED", "CHECKED", "IN_DEPT") AND corp="vip" AND crop_id=*
| fields corp ]
| stats dc(ID) as VIP_CX dc(crop_id) VIP_CORP 
| eval total=VIP_CX+VIP_CORP

but I would like to have that total plot over time by month and week I have tried the timechart function but it naver gives me what I want I know I am the one doing it wrong...  I'd like to know what would be the proper way to have "total" calculated by month or week without truncating the data... thank you so much to everyone willing to help me out

 

Kindly,

Cindy

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Assuming you have a _time field in both indexes, you should bucket/bin the time into the timespan you are interested in and then do the stats by the time field.

| multisearch
[ | search index=TRAVELS AND STATUS IN ("OK", "CHECKED", "ABORD") AND CLIENT_TYPE="vip" AND ID=*
| fields ID]
[ | search index=tv_int_ang AND STATUS IN ("BOOKED", "CHECKED", "IN_DEPT") AND corp="vip" AND corp_id=*
| fields corp ]
| bin _time span=1mon
| stats dc(ID) as VIP_CX dc(corp_id) as VIP_CORP by _time
| eval total=VIP_CX+VIP_CORP

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Assuming you have a _time field in both indexes, you should bucket/bin the time into the timespan you are interested in and then do the stats by the time field.

| multisearch
[ | search index=TRAVELS AND STATUS IN ("OK", "CHECKED", "ABORD") AND CLIENT_TYPE="vip" AND ID=*
| fields ID]
[ | search index=tv_int_ang AND STATUS IN ("BOOKED", "CHECKED", "IN_DEPT") AND corp="vip" AND corp_id=*
| fields corp ]
| bin _time span=1mon
| stats dc(ID) as VIP_CX dc(corp_id) as VIP_CORP by _time
| eval total=VIP_CX+VIP_CORP
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...