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.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...