Splunk Search
Highlighted

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

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
Highlighted

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

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
Highlighted

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

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
Highlighted

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

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
Highlighted

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

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
Speak Up for Splunk Careers!

We want to better understand the impact Splunk experience and expertise has has on individuals' careers, and help highlight the growing demand for Splunk skills.