Splunk Search

How to write a search to match and translate a field between two source types?

cpalicensing
New Member

I have a source type full of data with cryptic username fields. These usernames translate to human readable usernames via a SQL table that I pull into Splunk under a different source type (different log source). I know the correct way may be to use lookup tables, but is there a way in search where I can match and translate a field on the fly between two source types?

Thanks!

0 Karma

somesoni2
Revered Legend

You can do like this (assuming sourcetype1 is cryptic username field called username, sourcetype2 has fields username (cryptic) and h_username)

sourcetype=sourcetype1 OR sourcetype=sourcetype2 | stats values(sourcetype) as sourcetypes values(h_username) as h_username by username | where mvcount(sourcetypes)=2 

Or (slow performance)

sourcetype=sourcetype1 | join type=left username [search sourcetype2 | stats count by username h_username | fields - count]
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 ...