Splunk Search

How to retrieve names from comments and assign values to those names?

ramesh12345
Explorer

Hi,

We have closed cases and escalated cases,in that single person can work on particular case as well as multiple persons worked on particular case.So my requirement is to display in bar chart how many cases resolved and escalated by person.

Ex: Case:1111 Worked persons: Raju,Ramu,rahul
      Case:1112 Worked persons:  Ramu,rahul
      Case:1113 Worked persons: Raju      
      Case:1115 Worked persons: Ramu

So my chart should be

Raju count is 2
Ramu count is 2
rahul count is 1 like this

My Basic search is:

index="os" sourcetype="Service"  CaseNumber=* status=*  assignment_group=* |dedup _time,CaseNumber,assignment |streamstats current=f last(assignment) as lg, last(active) as  Active by CaseNumber|lookup test.csv check as assigned_to OUTPUT TeamName| eval is_escalated= if(assignment!=lg AND assignment="Sustaining",1,NULL) |eval is_resolved=if(assignment="Sustaining" AND status="Complete" AND (isnull(Active) OR Active="true"),1,NULL)|stats count(is_escalated) AS "Escalated Cases" count(is_resolved) AS "Resolved Cases"  assigned_to,TeamName| fields - TeamName

I retrieved the names from comments using below search:

index="os" sourcetype="Service" CaseNumber=*|dedup _time,CaseNumber,status|rex field=Comments"(?\w*\W*\w*\s*\w*\s*\s\(\d+\))" |stats values(Names) as Names by CaseNumber|nomv Names|table CaseNumber,Names,status

So I want to display resolved and escalated cases by name.Please help how to do this.

Tags (1)
0 Karma

vnravikumar
Champion

Hi @ramesh12345

Try this rex

| makeresults 
| eval comments="Case:1111 Worked persons: Raju,Ramu,rahul" 
| appendpipe 
    [| eval comments="Case:1112 Worked persons: Ramu,rahul"] 
| rex field=comments "Case:(?P<CaseNumber>.\d+).+\:\s(?P<Names>.+)$" 
| makemv delim="," Names 
| mvexpand Names 
| stats count by Names
0 Karma

ramesh12345
Explorer

Could you please send me the final query.

0 Karma

ramesh12345
Explorer

But my problem is whenever we write the condition eval is_resolved=if(assignment="Sustaining" AND status="Complete" AND (isnull(Active) OR Active="true"),1,NULL).it is showing only one person name.i want to assign that case to all who worked on that case.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...