Dashboards & Visualizations

Turning a field with status variables in to a new field with absolute an difference

Software-Simian
Path Finder

Hi,

i looked for an answer an some came close. But i could not get it flying.

Here is the Problem Description:

I have a field that contains the status of a ticket ("created_done").

I can easily count the number using by or doing that:

| stats count(eval(created_done="created")) as created count(eval(created_done="done")) as done by title impact

However i would like something like this:
| stats count by title impact status

status at this point should be a field holding the sum of solved tickets and the sum of open tickets:

TitleImpactStatusCount
title 1impact 1solved90
title 1impact 1open5
title 1impact 2solved45
title 1impact 2open3

 

Probably this has already been answered, i apologize in advance, but i could not get any solution working.

 

Kind regards,

Mike

Labels (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

One way to do it:

| makeresults 
| eval _raw="Title,   Impact,   Status,  Count
title 1,impact 1,solved,90
title 1,impact 1,created,95
title 1,impact 2,solved,45
title 1,impact 2,created,48"
| multikv forceheader=1
| fields - _raw, linecount
| streamstats reset_on_change=t window=1 first(Count) as preCount last(Count) as nxtCount by Title, Impact
| eval Open=nxtCount - preCount
| eval Status = if (Status=="created", "open", Status), Count = if(Status=="open", Open, Count)
| table Title, Impact, Status, Count

r. Ismo 

View solution in original post

Software-Simian
Path Finder

Hi,

actually the values come from exactly that field. so i want to get from:

TitleImpactStatusCount
title 1impact 1solved90
title 1impact 1created95
title 1impact 2solved45
title 1impact 2created48

 

to:

TitleImpactStatusCount
title 1impact 1solved90
title 1impact 1open5
title 1impact 2solved45
title 1impact 2open3
0 Karma

isoutamo
SplunkTrust
SplunkTrust

One way to do it:

| makeresults 
| eval _raw="Title,   Impact,   Status,  Count
title 1,impact 1,solved,90
title 1,impact 1,created,95
title 1,impact 2,solved,45
title 1,impact 2,created,48"
| multikv forceheader=1
| fields - _raw, linecount
| streamstats reset_on_change=t window=1 first(Count) as preCount last(Count) as nxtCount by Title, Impact
| eval Open=nxtCount - preCount
| eval Status = if (Status=="created", "open", Status), Count = if(Status=="open", Open, Count)
| table Title, Impact, Status, Count

r. Ismo 

Software-Simian
Path Finder

Hi Iso,

thanks, it works like a charme!!

 

regards,

Mike

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

if I understand this right, you have almost correct stats here. Just replace status -> created_done and after stats you could rename that field as status.

r. Ismo

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

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

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 ...