Splunk Search

how to set priority for each server based on their performance

tenyang
New Member

Hi all,

Currently I can search out the tablet name which has no data sent for more than 24 hours with below command 1. However, I also want to get the priority of them based on their performance (with command 2). Which means higher performance owns higher priority, even their silence hour may not be the highest.

could you please kindly guide me on how to combine these two commands together to get a final list, which is sorted by priority already.

Command 1:

shop_tags= "*wumart*" interaction_count="*" LIVE 
|stats latest(_time) AS lastReportTime BY mount_name
| eval silenceSeconds = now() - lastReportTime 
|eval silenceHour = silenceSeconds/3600
| where silenceHour > 24 
|table mount_name, silenceHour 
|eval silenceHour =round(silenceHour,1) 
|sort -silenceHour

Command2:

shop_tags= "*wumart*" interaction_count="*" LIVE 
|stats sum(interaction_count) AS sum_interaction_count BY mount_name 
|sort -sum_interaction_count

Thanks again.

Tags (3)
0 Karma
1 Solution

lguinn2
Legend

I have no idea what you mean by "priority" since there are no fields by that name. However, this will combine the two commands:

shop_tags= "*wumart*" interaction_count="*" live 
 | stats latest(_time) as lastReportTime sum(interaction_count) as sum_interaction_count by mount_name
 | eval silenceSeconds = now() - lastReportTime 
 | where silenceHour > 86400
 | sort -silenceHour -sum_interaction_count
 | fieldformat silenceHour=tostring(silenceHour,"duration")

View solution in original post

0 Karma

lguinn2
Legend

I have no idea what you mean by "priority" since there are no fields by that name. However, this will combine the two commands:

shop_tags= "*wumart*" interaction_count="*" live 
 | stats latest(_time) as lastReportTime sum(interaction_count) as sum_interaction_count by mount_name
 | eval silenceSeconds = now() - lastReportTime 
 | where silenceHour > 86400
 | sort -silenceHour -sum_interaction_count
 | fieldformat silenceHour=tostring(silenceHour,"duration")
0 Karma

tenyang
New Member

hi Lguinn,

Priority is defined by the performance of command2. According to the second command, i can get the interaction count for each tablet, so those who has higher performance, will get higher priority, so command1 can display according to that .

Do you have any idea on this situation?
Thanks so much.

0 Karma

lguinn2
Legend

Then change the sort to
| sort -sum_interaction_count -silenceHour

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...