Splunk Search

how to extract partial value from filed and show as column

naresh_553
New Member

Hi , Im trying to extract distinct email is as column and preparing some counts .For this im thinking to extract the email data from log field . Can someone please provide pointers

{
"log": " \u001b[2m2023-08-09 21:28:28.347\u001b[0;39m \u001b[32mDEBUG\u001b[0;39m \u001b[35m1\u001b[0;39m \u001b[2m---\u001b[0;39m \u001b[2m[nio-8080-exec-7]\u001b[0;39m \u001b[36ms.s.w.c.SecurityContextPersistenceFilter\u001b[0;39m \u001b[2m:\u001b[0;39m Set SecurityContextHolder to SecurityContextImpl [Authentication= SCOPE_profile1]], User Attributes: [{ email=venkatanaresh.mokka@one.verizon.com}], Credentials=[PROTECTED] ]]\n",
"stream": "stdout",

"kubernetes": {
"container_name": "draftx-ui-gateway",

}
}
Labels (3)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

You must have a field name log.  Use extract (aka kv) on it.

| rename log as _raw 
| kv

 

Tags (1)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

as usual there is another way too 😉 I'm expecting that this information is on field called "log". If it's something else then just change field=<your field name>

| rex field=log "email=(?<email>[^}]+)"

You could check by Job Inspector which one is better on your case.

r. Ismo 

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...