Splunk Search

Extract data from an entry that is dependant on data from a different entry

_dave_b
Communicator

Hello. I'm trying to extract a value from one log entry so I can use it to extract data from another entry, like
Entry 1 Has A and B
Entry 2 Has B and C
I want to get C from Entry 2 using A from Entry 1. I know I can use B to link them together somehow, but I don't know the command to do so. I've been trying subsearches and transactions, but nothing has worked for me.

Thanks for your help.

Tags (1)
0 Karma
1 Solution

the_wolverine
Champion

Assuming A, B, and C are field names.

  • transaction:

    Entry1 OR Entry2 | transaction B

  • subsearch:

    Entry2 | join B [ search Entry1 | fields A,B ] | table A,B,C

View solution in original post

the_wolverine
Champion

Assuming A, B, and C are field names.

  • transaction:

    Entry1 OR Entry2 | transaction B

  • subsearch:

    Entry2 | join B [ search Entry1 | fields A,B ] | table A,B,C

jluo_splunk
Splunk Employee
Splunk Employee

You can use the "where" command to compare field values (where field1=field2). Documentation for the where command: http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/Where

0 Karma

_dave_b
Communicator

Thanks, but how do I shoehorn that into one search statement?

0 Karma

jluo_splunk
Splunk Employee
Splunk Employee

Can you post the search statement you are currently working with?

0 Karma

_dave_b
Communicator

Sure,

date_year="2015" ClothingID="*" [search "Red"]  | rename ShoppingSessionID as Store_Visit | table Person, Store_Visit

I have 1 set of logs with multiple categories of entries. Some entries only have a person's ID, some only have a person's Shopping Session ID, and some have both a person's ID and Shopping session ID for a Successful Purchase (denoted by an entry of "Purchased Red Clothes"). Through these entries, I can link the person's ID to their particular Shopping Session where they made a purchase. I want to see who made a successful purchase of Red clothes.

0 Karma

jluo_splunk
Splunk Employee
Splunk Employee

Ah - I misunderstood the question. Transaction should do the trick.

source=log1 OR source=log2 | transaction CustomerID

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...