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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...