Hi,
Say I'm collecting crash reports into log A (I'm extracting the PID using rex) and the activity leading to said crash I am collecting into log B of another sourcetype. The only way to correlate both is through the PID BUT the twist is that log B _raw does not contain it, the source does. For example:
log A detects crash of session 123
I want to see all events logged into logB_123.log
I would expect the subsearch part to be giving the crash side (log A) but how do i relate this to the main search, in order to direct it to look a specific source using a number I got from log A?
Thanks Vincent.
You can extract the PID from the source
field, using rex
it'd look like this:
sourcetype=B | rex field=source "_(?<PID>\d+)\.log" | ...
Note, filtering on this will be slow because Splunk has to load everything from B, extract the PID, and then throw out most of the loaded data. It'll be faster if you specify the PID extraction through props.conf like this:
[B]
EXTRACT-PIDinsource = _(?<PID>\d+)\.log in source
You can do that once you have a PID
field in sourcetype B extracted like shown above.
sourcetype=B [search sourcetype=A some magic filter | dedup PID | fields PID]
The subsearch evaluates to an OR'd list of PID=1234
filters, which are applied against your configured EXTRACT-PIDinsource
.
Thanks Martin, but what I'm after is presenting the events within log B.
Literally I want my search to run like "give me the full list of events found in source X, where the X string contains the PID that's obtained from log A"
Thanks again Vincent.