Splunk Search

Stats for group of devices

bigll
Path Finder

I want to create statistic per group of device rather than individual devices.
I tried eval, but it produced no result.

| eval GR=case (host=5087, GR2, host=7750, GR1, host=7751, GR1, host=7752, GR2)
| stats count by GR.



TIA, Leon

Labels (2)
Tags (2)
0 Karma

bigll
Path Finder

Gents.

Thank you very much.
Proper placement of camas and double quotes solved the issue

------------

0 Karma

richgalloway
SplunkTrust
SplunkTrust

If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

---
If this reply helps you, Karma would be appreciated.
0 Karma

bigll
Path Finder

Thank you for recommendations. 
Gut an error:
Error in 'EvalCommand': The expression is malformed. Expected ).
Am I need double (()) around entire statement?

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

You do not need double parentheses.  Verify the parentheses and quotation marks match.  Share your exact query if you need an extra set of eyes to look at it.

---
If this reply helps you, Karma would be appreciated.

richgalloway
SplunkTrust
SplunkTrust

Have you tried putting quotes around the group names?

| eval GR=case(host=5087, "GR2", host=7750, "GR1", host=7751, "GR1", host=7752, "GR2")
| stats count by GR
---
If this reply helps you, Karma would be appreciated.

gcusello
SplunkTrust
SplunkTrust

Hi @bigll,

use quotes in eval:

| eval GR=case(host="5087", "GR2", host="7750", "GR1", host="7751", "GR1", host="7752", "GR2")
| stats count by GR.

Ciao.

Giuseppe

Get Updates on the Splunk Community!

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...