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!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...