Splunk Search

How to create column chart?

SCSC
Explorer

I created this data table by "mvappend" command.

dont have "_time" column and have only 3months records.

MONTH itemA itemB itemC

2022-05
2022-06
2022-07
1
2
3
4
5
6
7
8
9

 

I want to create a column chart : x-axis : MONTH , y-axis : value
from this data table.
But I cant by  using "chart" command.

Please let me know how to create.
Sorry if there are any mistakes in this  sentence.

Labels (1)
0 Karma
1 Solution

VatsalJagani
SplunkTrust
SplunkTrust

@SCSC - That's because everything is multi-value fields. It needs to be separated. Use the following commands at the end of your query:

| eval all_fields = mvzip(MONTH, mvzip(A, mvzip(B, C, "|"), "|"), "|")
| | fields all_fields | mvexpand all_fields
| rex field=all_fields "(?<MONTH>[^\|]+)\|(?<A>[^\|]+)\|(?<B>[^\|]+)\|(?<C>.+)"
| fields - all_fields

 

I hope this helps!!!

View solution in original post

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@SCSC - Your data is already in the correct format. (month on x-axis => first column, everything else for Y-axis). Hence you don't need to use a chart or any other command.

Once you see your data (in the statistics tab) in the format that you have here, you can just use the Visualization tab and select the column chart.

 

I hope this helps!!!

0 Karma

SCSC
Explorer

Thanks for reply.

I think so too, but I cant make column chart....

 

SCSC_0-1655791865103.pngSCSC_1-1655791870123.png

 

 

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@SCSC - That's because everything is multi-value fields. It needs to be separated. Use the following commands at the end of your query:

| eval all_fields = mvzip(MONTH, mvzip(A, mvzip(B, C, "|"), "|"), "|")
| | fields all_fields | mvexpand all_fields
| rex field=all_fields "(?<MONTH>[^\|]+)\|(?<A>[^\|]+)\|(?<B>[^\|]+)\|(?<C>.+)"
| fields - all_fields

 

I hope this helps!!!

0 Karma

SCSC
Explorer

I've solved the problem !
Thank you very much !!!:-)

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...