Splunk Search

Table per size and error code

LCM
Contributor

Hi all,

A though one for me, but maybe an easy one for you! I want to count error messages and show it in a table per size range.

Please 'enhance' the command: index="myindex" source="mysource" host="myhost" [your-magic]

I appreciate any creative ideas as long as it looks similarish as below 🙂

Output:

Message Size (KB)   failure    debug    error    NOT failure/debug/error
0-100               13         21       0        3939 
100-200             10         16       0        3
200-500             52          6       3        0
500-1000            29          2       35       5
>1000                0          0       58       0

Cheers,
Martin

0 Karma
1 Solution

Ledion_Bitincka
Splunk Employee
Splunk Employee

you can easily create that table by following these steps:

  1. compute the Message Size field and create the ranges you like
  2. create another field for the columns you need to have (below I assume you already have it and it's name is log_level)
  3. use the chart command to generate your table

Here's an example:

.... | eval ms=len(_raw) | eval MessageSize=if(ms<100, "0-100", if(ms<200, "100-200", ">200")) | chart count over MessageSize by log_level

View solution in original post

Ledion_Bitincka
Splunk Employee
Splunk Employee

you can easily create that table by following these steps:

  1. compute the Message Size field and create the ranges you like
  2. create another field for the columns you need to have (below I assume you already have it and it's name is log_level)
  3. use the chart command to generate your table

Here's an example:

.... | eval ms=len(_raw) | eval MessageSize=if(ms<100, "0-100", if(ms<200, "100-200", ">200")) | chart count over MessageSize by log_level
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...