Splunk Search

How to write a query which take all this values and search for results in different sourcetype=source2?

Mofizul
Loves-to-Learn Lots

 

index=instance1 sourcetype=source1 "Invalid-Access" | fields reqId | table reqId

 

The above query gives me a table as below

12A

32B

34C

Unable to write a query which take all this values and search for results in different sourcetype=source2.

Tried this below but not getting the results. Can anyone help ?

 

index=instance1 sourcetype=source2 [search index=instance1 sourcetype=source1 "Invalid-Access" | fields reqId | table reqId]

 

 

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Depends on what exactly you want to achieve.

Your search will effectively be expanded in run-time using subsearch results to

index=instance1 sourcetype=source2 ( reqId=12A OR reqId=32B OR reqId=34C)

 Is that what you wanted?

0 Karma

Mofizul
Loves-to-Learn Lots

Yes .

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use the format command instead of table to put the results of the subsearch into a format that can be queried.  Note that source1 and source2 must both have a field called 'reqId' or the subsearch will have to rename reqId to whatever source1 uses.

index=instance1 sourcetype=source2 [search index=instance1 sourcetype=source1 "Invalid-Access" | fields reqId | format ]

 

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

Mofizul
Loves-to-Learn Lots

Source1 has reqId but source 2 has the same value as reqId but it is a string.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...