Splunk Search

Is it possible to use a field containing a year and another value to create a time chart?

satpaldegun
New Member

Hi

I am not a Splunk expert and wanted to know if I can use a field as my timeline. For example, if I have a year field in my XML extracted together with some value - can I show this on the timechart with the value as my y-axis and year as my x-axis?

0 Karma
1 Solution

gokadroid
Motivator

Let's say you have the year value in field myYear and value you want to timechart in field myValue then you can try to do something like below and see if it works for your case:

your query to return myYear and myValue
| chart count(myValue) over myYear

You can use count, avg, min, max etc. whatever functions are of interest and apply to chart command. You can also | sort myYear OR | sort -myYear as the last line of the above command to achieve desired result of timechart, the way you like.

View solution in original post

0 Karma

gokadroid
Motivator

Let's say you have the year value in field myYear and value you want to timechart in field myValue then you can try to do something like below and see if it works for your case:

your query to return myYear and myValue
| chart count(myValue) over myYear

You can use count, avg, min, max etc. whatever functions are of interest and apply to chart command. You can also | sort myYear OR | sort -myYear as the last line of the above command to achieve desired result of timechart, the way you like.

0 Karma

satpaldegun
New Member

Hi

Thanks for the prompt response.

Can this be used to display multiple fields? So if there 3 data items like Country, Value & Year - can I display the Value for multiple countries over Year using Chart?

Thanks.

0 Karma

gokadroid
Motivator

How do you expect a value of "Country" and "Value" to come in visualization? However if the question is "can one plot multiple series over year", yes you can do as follows:

your query to return myYear and myValue
 | chart count(myValue), min(yourValue), max(everyOnesValue) over myYear
0 Karma

satpaldegun
New Member

Thanks for your suggestions - much appreciated and have now managed to use the following:-
... | chart sum(myValue) over myYear by myCountry

This seems to be working and thanks again.

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, ...