Splunk Search

Column order in statistics table created by chart is wrong

bowesmana
SplunkTrust
SplunkTrust

I have a command

host="daily" | chart count by Company, date_mday

which shows the fields

Company, 1, 10, 11, 15, 2, 3, 4, 7, 8, 9, Other

I want the column order to be numerically ordered by day of month and I want all columns displayed for all results, so I need to specify widths for the table.

How do I do this?

Tags (3)
0 Karma
1 Solution

alacercogitatus
SplunkTrust
SplunkTrust

host="daily" | eval mday = if(date_mday<10,"0".date_mday,date_mday) | chart useother=false limit=0 count by Company, mday | fillnull count value=0

This should get you most of the way there. It might need adjusted to fill in the null counts.

View solution in original post

alacercogitatus
SplunkTrust
SplunkTrust

host="daily" | eval mday = if(date_mday<10,"0".date_mday,date_mday) | chart useother=false limit=0 count by Company, mday | fillnull count value=0

This should get you most of the way there. It might need adjusted to fill in the null counts.

bowesmana
SplunkTrust
SplunkTrust

Thanks alacercogitatus! The eval statement shows me how to sort out the column ordering and the limit=0 makes it show all columns. useother in this case is redundant, but I understand where you're going with it. The fillnull simply added an extra 'count' column, but without it, it gave exactly what I needed.

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...