Splunk Search

How to use the timechart command to get a certain amount of time span in custom field?

brdr
Contributor

I have a lookup table with 3 fields: host, user, p_time

The events in the lookup table will contain 12 months of data. I have converted p_time to epoch format.

Simply, what I'm trying to accomplish is to use timechart command with a span of 1 month using p_time - to view the total number of events each month. As a side note, I would also like to include total number of events over 12 month period.

Any help would be appreciated.

Tags (3)
1 Solution

woodcock
Esteemed Legend

Just add this to the bottom of your existing search:

| eval _time = p_time
| timechart span=1mon count

View solution in original post

woodcock
Esteemed Legend

Just add this to the bottom of your existing search:

| eval _time = p_time
| timechart span=1mon count

somesoni2
Revered Legend

And add following after the timechart command to get total events for whole 12 month period

| eventstats sum(count) as TotalEvents
0 Karma

brdr
Contributor

Awesome. thank you both (as always) for responding 🙂

0 Karma

woodcock
Esteemed Legend

Nice tag-team, @somsoni2. So now you and @daljeanis are both stalking me and fixing my silly oversights and mistakes. Thanks for picking up my slack.

macadminrohit
Contributor

Is there another slack than the splunk user group slack ?

0 Karma

xpac
SplunkTrust
SplunkTrust

Yeah, the idiom "Pick up someones slack" 😉

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...