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!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...