In searching this I am reaching the conclusion that subsearches are viewed with some disdain by the more experienced Splunkers. I get that, so if there is a better way of carrying out what's I'm trying to achieve please shout!
I have Sendmail logs. I have a few users sent a dodgy email, so I search for the email address string. I pull out the message ID for those and plonk them in a subsearch. I then use this to search for the all the 'to' address fields. End result is I have a list of everyone who got the dodgy email. Search is:
index=email [search index=email from=bad_email_address | rex mode=sed field=msgid "s/[<>]//g" | rename msgid as search | table search] to=*
That only finds the first email. However, if I get the output of the subsearch by piping to format then copy and paste that into the search, replacing the subsearch, it works. Does anyone know why?
So, to be clear, the subsearch as above returns one result. If I manually copy and paste the results of the subsearch (which, to my mind is what the subsearch is dumping into the search anyway), it works as expected. I'm stripping the <> off the message ID as the 'to' event in the sendmail logs doesn't have them.
... View more