Getting Data In

Compare 2 field values from different sources.

arrowecssupport
Communicator

Scenario
We process emails looking for order numbers (ON). We need to be able to compare the order numbers we seen in the emails to our database. We're looking for matching and not matching order numbers.

How the data looks.
ON_email: 123, 234, 345, 456
ON_database: 123, 098, 456

Order numbers that match (seen in both database and emails): 123, 456
Order numbers only seen in database: 098
Order numbers only seen in emails: 234, 345

index = a OR index = b | table ON_email ON_database<< This works and shows all the data.
But when i try to compare i can't see any data.

Any ideas?

0 Karma

gcusello
SplunkTrust
SplunkTrust

try this:

| eval count=0 | append [ search  | stats count by order_number ] | stats sum(count) AS Total | where Total>0

in this way you can find the result of the first search that are also in the second one.
Be careful: the field name must be the same in both the searches, id they aren't, rename one of them.
Bye.
Giuseppe

0 Karma

gcusello
SplunkTrust
SplunkTrust

if you're satisfied of the answer, please, accept the answer.
Bye.
Giuseppe

0 Karma

sundareshr
Legend

Try this

index = a OR index = b | makemv ON_email delim="," | makemv delim=","  ON_database | eval ON=coalesce(ON_email, ON_database) | mvexpand ON | stats values(ON) by index
0 Karma

woodcock
Esteemed Legend

Try this:

index = a OR index = b | eval ON=coalesce(ON_email, ON_database) | stats dc(index) values(index) BY ON

Or maybe this:

index = a OR index = b | eval ON=coalesce(ON_email, ON_database) | stats values(ON) BY index
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...