Hi,
I have 2 columns: Name and Value.
My column names are dynamically changed.
How can I sort the column Names?
Please note I cannot use fields command to set the order since I don't know the column names in advance.
This is an example for my search:
... | chart avg(Value) AS Value by Name | sort -Value | head 10 | eval N=Name | eval Name ="" | xyseries Name N Value
I am replacing the X and Y with xyseries, so I get dynamic column names.
Is it possible to sort them?
Try this workaround (it will add a rank to in the values of Name but will do the sorting)
... | chart avg(Value) AS Value by Name| sort - Value| head 10 | eval rank=1 | accum rank | eval rank=rank-1| eval Name=rank." ".Name | eval rank="" | xyseries rank Name Value | table rank *
Try this workaround (it will add a rank to in the values of Name but will do the sorting)
... | chart avg(Value) AS Value by Name| sort - Value| head 10 | eval rank=1 | accum rank | eval rank=rank-1| eval Name=rank." ".Name | eval rank="" | xyseries rank Name Value | table rank *
This made the sort indeed.
Thanks you!!!
Try this
... | chart avg(Value) AS Value by Name | sort -Value | head 10 | eval N=Name | eval Name ="" | xyseries Name N Value | table *
Thanks for your response but it didn't help.
I am actually want to get my columns in the chart sorted.
I.E. the most highest column will be the most left column and the most lowest columns will be the most right column.
I am unable to do this because I used xyseries that replaced my axis and now each Value is a column and I cannot sort by this Value. Sort is working on column and now I need to sort by row.
Is this possible?
Hi @avadhutha -
I’m a Community Moderator in the Splunk Community.
This question was posted 10 years ago, so it might not get the attention you need for your question to be answered. We recommend that you post a new question so that your issue can get the visibility it deserves. To increase your chances of getting help from the community, follow these guidelines in the Splunk Answers User Manual when creating your post.
Thank you!