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!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...