Splunk Search

Question about constant and eval and stats

asarolkar
Builder

I have a search like this

sourcetype="syslog" | ... | stats c(eval(range="alpha")) AS ALPHA_COUNT c(eval(range="beta")) AS BETA_COUNT

This displays the count of alpha and beta in the form of a timechart just fine.



I need to lookup a field from a lookup table like this

| lookup gamma_count

This field is a constant



Then I need to display the three stacked in the form of a bar chart, so it looks like this

[alpha_ count] | [beta_ count] | [gamma_count]

Any ideas ?

Any help would be appreciated

Tags (3)
0 Karma
1 Solution

lguinn2
Legend

Try this:

sourcetype="syslog" | ... 
| stats count by range
| append [ inputlookup gamma_count | eval count=gamma_count | eval range="gamma' | fields range count]

I am not quite sure how to get the graph, but this should come close. You may have to play around with the charting options.

View solution in original post

0 Karma

lguinn2
Legend

Try this:

sourcetype="syslog" | ... 
| stats count by range
| append [ inputlookup gamma_count | eval count=gamma_count | eval range="gamma' | fields range count]

I am not quite sure how to get the graph, but this should come close. You may have to play around with the charting options.

0 Karma

lguinn2
Legend

sourcetype="syslog" | ...
| timechart count by range
| eval gamma=alpha-beta

should do it. Though you probably want to set the span option on the timechart command.

asarolkar
Builder

Thanks much !

Just wondering, what do I do if gamma count is the difference between alpha_count and beta_count (NOT read from a lookup file)

How would i plot that ?

Best regards

0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...