<?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 Can we Regex while  using &amp;quot;OR&amp;quot; in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308598#M4081</link>
    <description>&lt;P&gt;I have two indexers where i have to compare one field among them.I don't want to use join,Instead of that i used OR condition But the thing is from one of the index I have to extract a field using rex during search time .How can I do that. &lt;BR /&gt;
&lt;STRONG&gt;index A&lt;BR /&gt;
Sample Field (this field already present in the index )&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index B&lt;BR /&gt;
I have to extract the field&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Here is the sample Query &lt;BR /&gt;
 (index=A sourcetype=xyz) OR (index=B sourcetype=ABC )&lt;BR /&gt;
 | rex "doc_name:\"(?[^+]+)"&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;when I am doing this it is considering only one index data i.e only from B index it is taking data. How can I over come this?&lt;/P&gt;</description>
    <pubDate>Sun, 19 Feb 2017 01:42:14 GMT</pubDate>
    <dc:creator>vikasreddy</dc:creator>
    <dc:date>2017-02-19T01:42:14Z</dc:date>
    <item>
      <title>Can we Regex while  using "OR"</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308598#M4081</link>
      <description>&lt;P&gt;I have two indexers where i have to compare one field among them.I don't want to use join,Instead of that i used OR condition But the thing is from one of the index I have to extract a field using rex during search time .How can I do that. &lt;BR /&gt;
&lt;STRONG&gt;index A&lt;BR /&gt;
Sample Field (this field already present in the index )&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;index B&lt;BR /&gt;
I have to extract the field&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Here is the sample Query &lt;BR /&gt;
 (index=A sourcetype=xyz) OR (index=B sourcetype=ABC )&lt;BR /&gt;
 | rex "doc_name:\"(?[^+]+)"&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;when I am doing this it is considering only one index data i.e only from B index it is taking data. How can I over come this?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 01:42:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308598#M4081</guid>
      <dc:creator>vikasreddy</dc:creator>
      <dc:date>2017-02-19T01:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can we Regex while  using "OR"</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308599#M4082</link>
      <description>&lt;P&gt;Right, you are on the right track as the simulation of JOIN can be done via &lt;CODE&gt;OR&lt;/CODE&gt; and then &lt;CODE&gt;stats&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;The following explains it nicely by @sideview - &lt;A href="https://answers.splunk.com/answers/822/simulating-a-sql-join-in-splunk.html"&gt;simulating a SQL JOIN in Splunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It says &lt;/P&gt;

&lt;P&gt;-- But here's how to do it just with search and stats. One big OR clause in search mashes the two data sets together and then we do a little bit of stats command to merge it all into what we want. &lt;/P&gt;

&lt;P&gt;The code example is - &lt;CODE&gt;source=costtable OR source=usertable | stats first(username) as name sum(cost) as total by userid | sort - total | fields username total&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 03:21:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308599#M4082</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-02-19T03:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can we Regex while  using "OR"</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308600#M4083</link>
      <description>&lt;P&gt;But My Question is how can I do that?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 05:36:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308600#M4083</guid>
      <dc:creator>vikasreddy</dc:creator>
      <dc:date>2017-02-19T05:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can we Regex while  using "OR"</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308601#M4084</link>
      <description>&lt;P&gt;Probably you need to do the following - &lt;/P&gt;

&lt;P&gt;1) OR the two indexes&lt;BR /&gt;
2) extract the field from index B, and producing a field with same name as the field from A&lt;BR /&gt;
3) stats on this  field, per example above&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 20:51:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308601#M4084</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2017-02-19T20:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can we Regex while  using "OR"</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308602#M4085</link>
      <description>&lt;P&gt;I am not able to go forward , Here is my detail explanation &lt;/P&gt;

&lt;P&gt;I have a Index A from which i have to take a field name Say "Sample". In index B I have to extract a field using  rex with same name "Sample". the thing is when we using OR it is extracting the field sample from one index only i.e index B . how to get field and values from both the index? &lt;/P&gt;

&lt;P&gt;detail query&lt;/P&gt;

&lt;P&gt;(index= A  sourcetype=xyz) OR (index=B sourcetype=cdf )&lt;BR /&gt;
|rex"^)?P[^,]*)&lt;/P&gt;

&lt;P&gt;i have  written the query in this type when i ran it's show data from ony index B .how can i get data from both the index ?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 04:06:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308602#M4085</guid>
      <dc:creator>vikasreddy</dc:creator>
      <dc:date>2017-02-20T04:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can we Regex while  using "OR"</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308603#M4086</link>
      <description>&lt;P&gt;Let's assume that there is a field name "sample" on index A, and no such field on B.  However, in the _raw on B there is a section that the value of sample can be pulled from, and no such section on index A.  Let's also assume that there is a value statA on A and a value statB on B that you need to get the total of.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=A sourcetype=xyz) OR (index=B sourcetype=ABC )
| rex "doc_name:\"(?&amp;lt;sampleB&amp;gt;[^+]+)"
| eval sample =coalesce(sample,sampleB)
| stats sum(statA) as StatA sum(statB) as statB by sample
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Feb 2017 21:19:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-Regex-while-using-quot-OR-quot/m-p/308603#M4086</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-20T21:19:37Z</dc:date>
    </item>
  </channel>
</rss>

