Splunk Search

Visualization not appearing?

Hartmannish
Explorer

I'm trying to make visualizations appear. A simple column or bar chart. My search works exactly as intended (a series of columns for numbers and percent across spans of one day). But I can't get any visualizations anymore. What did I do, and is there a way to get back visualizations while also keeping my table?

host=server* Identifier=name EventType=various* EventType!=not_those 
| rex "(?<DeviceId>[0-9a-zA-Z]+)\s+event" 
| bucket _time span=1d
| eventstats dc(DeviceId) AS all_visitors by _time
| search (EventType="type1" OR EventType="type2" OR EventType="type3") 

| stats first(all_visitors) AS all_visitors dc(DeviceId) AS dc_event_type by EventType, _time

| eval one=if(EventType="type1", dc_event_type, " ") 
| eval two=if(EventType="type2", dc_event_type, " ") 
| eval three=if(EventType="type3", dc_event_type, " ") 

| eval percentage=round(dc_event_type/all_visitors*100,2) 

| eval one%=if(EventType="type1", percentage, " ") 
| eval two%=if(EventType="type2", percentage, " ") 
| eval three%=if(EventType="type3", percentage, " ") 

| timechart span=1d values(all_visitors) AS "Everybody" 

values(one) AS "one" values(two) AS "two" values(three) AS "three" 

values(one%) AS "one %" values(two%) AS "two %" values(three%) AS "three %"
Tags (2)
0 Karma

woodcock
Esteemed Legend

You cannot timechart a multi-value field which is what values creates (think about the Y-axis and how it works). if you change it to something that generates a single-value number field, then it will show in the visualization. For example, if you change each values to count then your visualization will work.

Hartmannish
Explorer

Thanks for the explanation. I guess this means there isn't much to do? Since, changing values to count doesn't give my table the values I need. Maybe using eval somehow turns in into single-value fields? I tried, but only the first column is kept, if I do like this:
| timechart span=1d eval(round(values(all_visitors),2)) AS "Everybody"
eval(round(values(all_visitors,2)) AS "one"... and so on

0 Karma

woodcock
Esteemed Legend

I was not suggesting that changing values to stats would achieve your end goal but only that it would demonstrate what was blocking the visualization. I assume that it did exactly that and now that this question is resolved (why no visualization), perhaps you should back all the way up and describe exactly what you are trying to accomplish and I am sure there is a way to do it. This should include some sample data and some kind mockup of the desired output. This should probably be in another (new) question.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...