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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...