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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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