Splunk Search

How to edit position of column in statistic cable?

jialiu907
Path Finder


Splunk table position error.pngI am looking to have the middle row of this table be in the left instead. I think something in the query is off and causing it to have a weird behavior. 

index=main host=* sourcetype=syslog process=elcsend "\"config" $city$
| rex "([^!]*!){16}(?P<MEMGB>[^!]*)!"
| chart count by MEMGB
| addcoltotals label=Total labelfield=MEMGB
| sort count desc

This is the current search query. The rex provides the data in the MEMGB column.

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Numeric fields are right-aligned, string fields are left-aligned so convert your MEMGB field values to strings and add a trailing space

index=main host=* sourcetype=syslog process=elcsend "\"config" $city$
| rex "([^!]*!){16}(?P<MEMGB>[^!]*)!"
| chart count by MEMGB
| addcoltotals label=Total labelfield=MEMGB
| eval MEMGB=tostring(MEMGB)." "
| sort count desc

 

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Please clarify the request.  There are 10 rows displayed so there is no middle one.  Not that it matters since there is no left/right orientation for (horizontal) rows.  If you are referring to the columns, then again I ask for clarification since there is no middle column when there are only 2 of them.

That said, if you want to put the "Total" value at the bottom, put the addcoltotals command after the sort.

---
If this reply helps you, Karma would be appreciated.
0 Karma

jialiu907
Path Finder

Sorry for the confusion, I can clarify. I am looking for the left column in the picture to be in the left-most area where it is typically located when using the stats/chart count by command and not in the middle of the overall table.

Splunk table position error2.png

Similar to the CPUMFR column in picture above.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Numeric fields are right-aligned, string fields are left-aligned so convert your MEMGB field values to strings and add a trailing space

index=main host=* sourcetype=syslog process=elcsend "\"config" $city$
| rex "([^!]*!){16}(?P<MEMGB>[^!]*)!"
| chart count by MEMGB
| addcoltotals label=Total labelfield=MEMGB
| eval MEMGB=tostring(MEMGB)." "
| sort count desc

 

jialiu907
Path Finder

Thanks for the new knowledge. That is what I was looking for

Get Updates on the Splunk Community!

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco &#43; Splunk! We’ve ...

Enterprise Security Content Update (ESCU) | New Releases

In April, the Splunk Threat Research Team had 2 releases of new security content via the Enterprise Security ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...
OSZAR »