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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...