Splunk Search

how to use table with percentage?

pacifikn
Communicator

Hi ALL!!

Help me on how I can use the table function in query with percent

|table  field-1, field-2, field-3  |stats count by  field-1, field-2, field-3

| eval  percentage=round(count/total*100,2)."%" |fields - total 

This is the query I used but there's no percentage columns appeared, what query can I use to displ

Kindly help me out????

here's the column i want to have:

host       signature   action    count     percentage   

I need your help?

 

- Other Question , what makes the query to take long time loading or more time to display after pressing search button?

Thanking you in advance.

 

 

 

 

 

Labels (3)
Tags (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Slow queries are generally due to

  • too much data
  • poor hardware
  • too long a time search window
  • badly written queries

In your query, you are searching all indexes - what is your time range and how much data are you dealing with.

 

0 Karma

bowesmana
SplunkTrust
SplunkTrust

You do not need to use table if you are following this with an aggregation, like stats.

You don't have a total calculated anywhere, so cannot do the eval you are trying to do

index=* action=*  
| stats count by  host, signature, action
| eventstats sum(count) as total
| eval percentage=round(count/total*100,2)."%" 
| fields - total 

The eventstats will then sum all the counts to get the total and you can then do your percentage calculation afterwards

 

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 ...