Splunk Search

What is the most efficient way of comparing two indexes.

michaelrosello
Path Finder

I'm comparing in event1 from indexA is existing in indexB.
Currently I am using join in comparing this two indexes but it is slow when a lot of data exist.

Is there a more faster and efficient way in achieving this result?

index=indexA 
        | eval indexA_message_id = Message_ID
        | join type=outer Message_ID
    [ search index=indexB
    | eval indexB_message_id = Message_ID 
    | fields Message_ID mdh_message_id]
| where NOT indexA_message_id=indexB_message_id
| table Transaction_Type indexA_message_id
Tags (2)
0 Karma

MuS
Legend

Hi michaelrosello,

try this:

index=indexA OR index=indexB 
| stats count dc(index) AS dc_idx values(*) AS * by Message_ID 
| where dc_idx = 1 
| table Transaction_Type Message_ID

The where clause is your filter to get events that are either only in one of the indexes (1) or in both (2).

Hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...