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

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...