Splunk Search

Create One Field Value from two indexes

katzr
Path Finder

Hello,

I have index=A with values from January-April with the field value called EmailA. I have another index with values from May-June with a field value called EmailB. I need to look at the most frequent Emails from January to June. This is the search I am using but it is not combining the emails correctly- the field Email is pulling only from Index=A since I renamed that one last. An email could be used in January and June and I need to have the total count across both indexes.

index =A OR index =B NOT source = 433 | eval EmailA=lower(EmailA)| eval EmailB =lower(EmailB) | rename EmailB as Email | rename EmailA as Email | stats count by Email

And I am running this search with the time picker set from January to June. Thank you for the help!

0 Karma
1 Solution

s2_splunk
Splunk Employee
Splunk Employee

Try this: index =A OR index =B NOT source = 433 | eval Email=coalesce(EmailA,EmailB) | stats count by Email
Field values are not case-sensitive in Splunk, but if you want them lower case, you can wrap the coalesce in a lower() function.

View solution in original post

s2_splunk
Splunk Employee
Splunk Employee

Try this: index =A OR index =B NOT source = 433 | eval Email=coalesce(EmailA,EmailB) | stats count by Email
Field values are not case-sensitive in Splunk, but if you want them lower case, you can wrap the coalesce in a lower() function.

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!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...