<?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 Pattern match on two different fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32900#M6930</link>
    <description>&lt;P&gt;I am performing a search where I want to find events if one of two fields matches a specific pattern (which is the same for both fields). I've tried regex, but it doesn't seem to like an OR operator. &lt;/P&gt;

&lt;P&gt;search traffic | transaction Acct_ID startswith="START" endswith="STOP" | regex Egress="^\w{3}&lt;EM&gt;\d{4}" OR regex Ingress="^\w{3}&lt;/EM&gt;\d{4}"&lt;/P&gt;

&lt;P&gt;Is there any way to do this?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:47:58 GMT</pubDate>
    <dc:creator>tnkoehn</dc:creator>
    <dc:date>2020-09-28T12:47:58Z</dc:date>
    <item>
      <title>Pattern match on two different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32900#M6930</link>
      <description>&lt;P&gt;I am performing a search where I want to find events if one of two fields matches a specific pattern (which is the same for both fields). I've tried regex, but it doesn't seem to like an OR operator. &lt;/P&gt;

&lt;P&gt;search traffic | transaction Acct_ID startswith="START" endswith="STOP" | regex Egress="^\w{3}&lt;EM&gt;\d{4}" OR regex Ingress="^\w{3}&lt;/EM&gt;\d{4}"&lt;/P&gt;

&lt;P&gt;Is there any way to do this?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32900#M6930</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2020-09-28T12:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern match on two different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32901#M6931</link>
      <description>&lt;P&gt;I believe you are close, however since regex drops events, I'd go a different path and use some matching in eval. Try this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search traffic | transaction Acct_ID startswith="START" endswith="STOP"| eval ematch=if(match(Egress,"^\w{3}\d{4}"),1,0)|eval imatch=if(match(Ingress,"^\w{3}\d{4}"),1,0)|where ematch&amp;gt;0 OR imatch&amp;gt;0&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 18:59:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32901#M6931</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2012-11-13T18:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern match on two different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32902#M6932</link>
      <description>&lt;P&gt;You are a rock star! Works great. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 19:10:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32902#M6932</guid>
      <dc:creator>tnkoehn</dc:creator>
      <dc:date>2012-11-13T19:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern match on two different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32903#M6933</link>
      <description>&lt;P&gt;+1  @alacercogitatus Really nice way of avoiding using the regex command and using the eval functions instead. My solutions would have been to use rex to grab things out.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 20:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32903#M6933</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2012-11-13T20:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern match on two different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32904#M6934</link>
      <description>&lt;P&gt;Thanks! Just doing my part to help!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2012 20:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pattern-match-on-two-different-fields/m-p/32904#M6934</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2012-11-13T20:23:48Z</dc:date>
    </item>
  </channel>
</rss>

