Splunk Search

Timechart with sum at single value level

CarmineCalo
Path Finder

Splunkers!
Need your help...

I created a search piping the following fields (simplified)

_time AppID Incident_duration

I have to group incidents duration by week, running a timechart, at AppID level:

| timechart span=1w values(AppID) as AppID, sum(incident_duration) as Weekly_Inc_duration

Unfortunately, returned AppID field is a multivaluefield (whenever in the same week there are multiple AppID with an incident event) and in this case Weekly_Inc_duration is the sum of the duration for all those AppIDs.
I'd like to get as output the sum at AppID level.

Can you help me?

Tks!
CArmine

0 Karma
1 Solution

mayurr98
Super Champion

hey

looking at your comments section you can try

| eval dateyearweek=strftime(_time,"%Y-%U") | stats  sum(incident_duration) as Weekly_Inc_duration BY AppID dateyearweek

Depending of your country, you have 2 variations :

%U is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number [00,53].

%V is replaced by the week number of the year (Monday as the first day of the week) as a decimal number [01,53]. If the week containing 1 January has four or more days in the new year, then it is considered week 1. Otherwise, it is the last week of the previous year, and the next week is week 1.

Let me know if this helps!

View solution in original post

mayurr98
Super Champion

hey

looking at your comments section you can try

| eval dateyearweek=strftime(_time,"%Y-%U") | stats  sum(incident_duration) as Weekly_Inc_duration BY AppID dateyearweek

Depending of your country, you have 2 variations :

%U is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number [00,53].

%V is replaced by the week number of the year (Monday as the first day of the week) as a decimal number [01,53]. If the week containing 1 January has four or more days in the new year, then it is considered week 1. Otherwise, it is the last week of the previous year, and the next week is week 1.

Let me know if this helps!

micahkemp
Champion

Do you mean like:

| timechart span=1w sum(incident_duration) as Weekly_Inc_duration BY AppID
0 Karma

CarmineCalo
Path Finder

This is an option,
but I'd like to get a tabular output, like

incident duration AppID Weekly_Inc_duration

in order to have the chance afterwards to append some further column and import this search as DataSet for further processing.

Tks!
Carmine

0 Karma

CarmineCalo
Path Finder

Probably i found the solution
Timechart was the wrong way to create the dataset i was looking for.

I add within the search the calculation of fa field, dateweek_year, extracting Year+Week from _time
Than i simply run the stats command, in this way

| stats sum(incident_unavailability) as Unavailability by dateweek_year, CI

It seems to work 🙂

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...