<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get match to work with two sources in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464153#M130829</link>
    <description>&lt;P&gt;It sounds/look to me the regex does not match correct, can you add a list of some &lt;CODE&gt;REF&lt;/CODE&gt; values here?&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2019 21:14:32 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2019-08-26T21:14:32Z</dc:date>
    <item>
      <title>How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464146#M130822</link>
      <description>&lt;P&gt;Okay so here's the problem, 2 sources and I have to rex out a file name and match it to a field within another file if it matches show success it if fails show failed, all sounds achievable in Splunk, but I keep hitting a problem that it will show a success match but won't show a failed match,&lt;/P&gt;

&lt;P&gt;Heres the code ( I've changed the fields etc but see below):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Any help on this would be great Im new to splunk 
index="sample_log" sourcetype="STAR:OUT:ALL" | rename Trans_Name as REF |lookup REF APPL-FILENAME as Stream_Name |join 
REF [search index="sample_log" sourcetype="STAR:OUT:ACK" | rex field=source "ACK
_(?&amp;lt;REF&amp;gt;\w+)_" ]
|rex field=source "_(?&amp;lt;STP_Process_Time&amp;gt;\d{14})."
| eval results = if(match('REF', "\w{10}\d{6}\w+"), "Success", "Failed")
|table results
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:17:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464146#M130822</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2019-08-26T20:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464147#M130823</link>
      <description>&lt;P&gt;Hi rossparfect,&lt;/P&gt;

&lt;P&gt;give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index="sample_log" sourcetype="STAR:OUT:ALL") OR (index="sample_log" sourcetype="STAR:OUT:ACK" )
| rex field=source "ACK _(?&amp;lt;REF&amp;gt;\w+)_"
| eval REF=case(isnotnull(Trans_Name),  Trans_Name, isnotnull(REF), REF, 1=1, "unknown") 
| lookup REF APPL-FILENAME as Stream_Name 
| rex field=source "_(?&amp;lt;STP_Process_Time&amp;gt;\d{14})."
| eval results = if(match(REF, "\w{10}\d{6}\w+"), "Success", "Failed")
| table results
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this still does not work, start removing &lt;CODE&gt;| SPL&lt;/CODE&gt; from the back until you get the expected results. &lt;/P&gt;

&lt;P&gt;Otherwise provide some sanitised sample events and the expect result and it will be easier to help.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:27:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464147#M130823</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-08-26T20:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464148#M130824</link>
      <description>&lt;P&gt;hmm you are performing a join by REF and you extract a rex also as REF.&lt;BR /&gt;
So, what happens? by default the join  command takes common field (A intersection B in set language), are you sure you , in fact have REF fields which should return failed?&lt;BR /&gt;
The intersection join be default will return events (with REF field) common to both searches. Do the common REF fields have the same pattern as your match regex?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:28:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464148#M130824</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-26T20:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464149#M130825</link>
      <description>&lt;P&gt;Ill give that a shot and get back to you thanks Mus ( should add ive been reading all your other answers and your splunk conf presentations) all good stuff ( that said I think Ive ended up down a dark hole with this one,&lt;/P&gt;

&lt;P&gt;Ill update shortly,&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Ross&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:29:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464149#M130825</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2019-08-26T20:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464150#M130826</link>
      <description>&lt;P&gt;HaHA, nice played Sir &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:37:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464150#M130826</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-08-26T20:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464151#M130827</link>
      <description>&lt;P&gt;Hi Mus cant attach files do you have an email address I can send to ?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464151#M130827</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2019-08-26T20:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464152#M130828</link>
      <description>&lt;P&gt;or example would be as follows&lt;/P&gt;

&lt;P&gt;CSV files and outbound file and then an inbound acknowledgement file,&lt;/P&gt;

&lt;P&gt;The outbound would have the field transmission inside the file &lt;/P&gt;

&lt;P&gt;transmission&lt;BR /&gt;
123456&lt;/P&gt;

&lt;P&gt;the ack file would only have success in the file itself but in the file name would have&lt;/P&gt;

&lt;P&gt;123456&lt;/P&gt;

&lt;P&gt;so I have to extract the file name from the ack file and then match it to a field name in another file, all with different sources.&lt;/P&gt;

&lt;P&gt;I can get it to show a success but it wont show any failed files (which is what we need as well), tried the above and it came back with 5 out of 5 but should only have 2 out of five,&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464152#M130828</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2019-08-26T20:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464153#M130829</link>
      <description>&lt;P&gt;It sounds/look to me the regex does not match correct, can you add a list of some &lt;CODE&gt;REF&lt;/CODE&gt; values here?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 21:14:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464153#M130829</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-08-26T21:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464154#M130830</link>
      <description>&lt;P&gt;Hi Mus , Ill add some tomorrow, its 23:36 in the Uk and Im knackered, however if I do a stats values and an MV expand i do get a result that the fields match, however cant do much after that with that search, Ill post that up tomorrow as well,&lt;/P&gt;

&lt;P&gt;Thanks for your help so far,&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 22:41:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464154#M130830</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2019-08-26T22:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464155#M130831</link>
      <description>&lt;P&gt;Evening Mus&lt;/P&gt;

&lt;P&gt;Ok another day at it and still struggling ( tried a case statement and it works when I put in the txt for the ref and compare) but not when I try and compare the 2 fields.&lt;/P&gt;

&lt;P&gt;So heres some example sources and sourcetypes&lt;/P&gt;

&lt;P&gt;Source type one - obi:one:ken:out&lt;BR /&gt;
Source type two - obi:one:ken:ack&lt;/P&gt;

&lt;P&gt;source - ack_123456aaabbb_13052019.csv - contents Success&lt;BR /&gt;
souce starwars_outbound.csv - contents Transmission / 123456aaabbb&lt;/P&gt;

&lt;P&gt;What needs to happen&lt;/P&gt;

&lt;P&gt;I need to extract the tranmission from the source file and then match it to the contents in the outbound.csv file.&lt;/P&gt;

&lt;P&gt;I then need to put all the details in a table with additional fields from a lookup and contents from the file, but and this is where it starts to fall down,&lt;/P&gt;

&lt;P&gt;If there isnt a match or the source file doesnt exist ( it may come in later) then I need to show that as failed.&lt;/P&gt;

&lt;P&gt;The best I can get is either having it working using stats(values) and an MVexpand which doesnt allow me much else that I can display, or just having a success being displayed, for example for 2 out of the 5 files,&lt;/P&gt;

&lt;P&gt;When I should see the following&lt;/P&gt;

&lt;P&gt;Transmission Outtype Filetype Acknowledgement Time&lt;BR /&gt;
123456aaabbb D Light Success&lt;BR /&gt;
123456aaaccc  E  sabre failed &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:57:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464155#M130831</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2020-09-30T01:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464156#M130832</link>
      <description>&lt;P&gt;You're provided samples here that will never match the initial posted search &lt;/P&gt;

&lt;P&gt;For example you're doing a regex on source for ACK but provide source as ack_ above, the other thing is that &lt;CODE&gt;REF&lt;/CODE&gt; should match another regex of 10 any word characters followed by 6 digits followed by one or more any word character but the provided sample contains 6 digits followed by 6 any word characters &lt;CODE&gt;¯\_(ツ)_/¯&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You really should provide some real sample events, otherwise there is no way I can help you.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 23:21:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464156#M130832</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-08-28T23:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464157#M130833</link>
      <description>&lt;P&gt;thanks Mus,&lt;/P&gt;

&lt;P&gt;Alas cant post any real events due to the company I work for, &lt;/P&gt;

&lt;P&gt;However apologies yes it should be ACK, &lt;/P&gt;

&lt;P&gt;So for example ( and these are as close as I can get to real events)&lt;/P&gt;

&lt;P&gt;File one is &lt;/P&gt;

&lt;P&gt;Outside_SHM300TW_20190730.csv &lt;/P&gt;

&lt;P&gt;Contents in it&lt;/P&gt;

&lt;P&gt;XAHBAABCXX21081AA,SHM300TW&lt;/P&gt;

&lt;P&gt;Which has to then be matched to a different source that has the long ref number in the title of the CSV&lt;/P&gt;

&lt;P&gt;so&lt;/P&gt;

&lt;P&gt;ACK_XAHBAABCXX21081AA_20190730.csv&lt;/P&gt;

&lt;P&gt;So what I need to do is regex out the number after the ACK and then match it to contents of the other file,&lt;/P&gt;

&lt;P&gt;however I also need to show the events that dont have a match yet,&lt;/P&gt;

&lt;P&gt;Hopefully that helps as thats the closest I can get to sharing events ( as Ive had to make these up based on the actual events)&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;

&lt;P&gt;Ross&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:00:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464157#M130833</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2020-09-30T02:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464158#M130834</link>
      <description>&lt;P&gt;Hi Mus,&lt;/P&gt;

&lt;P&gt;Feel free to swear on this one ( Im scottish so do it alot) however Ive sorted my issue, &lt;/P&gt;

&lt;P&gt;I spoke to the data owners again and I have used and outer to do the join then a eval on if the actual process time is present for the ack file ( as if it isnt there isnt an ack file), this allows me to show a result or not sent,&lt;/P&gt;

&lt;P&gt;So all in all, now can have a Acknowledgement of either success or Not sent,&lt;/P&gt;

&lt;P&gt;Thanks for your help though and Ill continue watching the videos, ppts and following you on Splunk answers.&lt;/P&gt;

&lt;P&gt;onwards and upwards&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Ross&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 09:16:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464158#M130834</guid>
      <dc:creator>rossparfect</dc:creator>
      <dc:date>2019-08-29T09:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get match to work with two sources</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464159#M130835</link>
      <description>&lt;P&gt;HaHA, no reason to swear &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Glad you made it work for you in the end!&lt;/P&gt;

&lt;P&gt;Slàinte, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 20:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-match-to-work-with-two-sources/m-p/464159#M130835</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-08-29T20:03:45Z</dc:date>
    </item>
  </channel>
</rss>

