Splunk Search

how to find the Unique field value which is present in two different source logs

RashmiGowda
Explorer

My question is how to find the uniqueId which is present in two different source logs..?

I have 2 source logs say, abc.log and xyz.log. abc.log has fields called "RequestID" and "RequestStartTime". xyz.log has fields called "TransactionID" and "TransEndTime". Now i have to find and display a UniqueID which is present in both "RequestID" and "TransactionID" with RequestStartTime and TransEndTime..??

Can anyone please suggest how m able to do this in splunk..??

Thanks in advance 🙂

Tags (2)
0 Karma

gauldridge
Path Finder

You could try:

source="abc.log" OR source="xyz.log" | eval UniqueID=coalesce(RequestID,TransactionID) 

and then depending on how you want the output formatted, you could do something like:

| stats c by UniqueID,RequestStartTime,TransEndTime | fields - c

or

| chart values(RequestStartTime) AS Start values(TransEndTime) AS End by UniqueID

gauldridge
Path Finder

So, is it correct to say that the RequestID is unique per transaction but the TransactionID is not?

Is the UniqueID you mention something that actually exists in the events or something you need to create on-the-fly?

Is there something in either one or both of the log types that always indicates the beginning and end of the transaction?

Is it possible for you to share a snippet of each of the log sources? Even if it is scrubbed, it might be easier to troubleshoot with an example of the data at this point.

0 Karma

RashmiGowda
Explorer

No.. RequestID is Unique. Its not used by Multiple Transactions
@gauldridge

0 Karma

gauldridge
Path Finder

Does that mean that RequestID is also used by multiple transactions?

0 Karma

RashmiGowda
Explorer

Actually TransactionID is being reused by multiple transactions. Its not that beginning of transaction in abc.log and end in xyz.log.

What i need to do is, i need to corelate the events from abc.log and xyz.log based on the UniqueiD which is present in both the logs. so i created "RequestID" for abc.log and TransactionID for xyz.log.

now i need to pick up the uniqueid which is present in both RequestID and TransactionID. RequestID contains uniqueID of abc.log and TransactionID contains uniqueiD of xyz.log

@gauldridge

0 Karma

gauldridge
Path Finder

Are there multiple "copies" of the same transaction in the xyz.log source or is the TransactionID being recycled/reused by multiple transactions? Also, is the beginning of a transaction always in abc.log and the end always in xyz.log?

0 Karma

RashmiGowda
Explorer

above query is giving duplicate results also. its also displaying id's whcih are not present in RequestID and TransactionID.. 😞

0 Karma

RashmiGowda
Explorer

Thank you. But how to eliminate the duplicate TransactionID. because in xyz.log there are Transactions which are appering more than once. Could you please suggest..??

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...