<?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 combain two rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combain-two-rex/m-p/701447#M237936</link>
    <description>&lt;P&gt;The queries can be combined like this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=teams ("osversion=" OR "host=12*")
| rex field=_raw "\s+(?&amp;lt;osVersion&amp;gt;.*?)$"
| rex field=_raw "\w+(?&amp;lt;host&amp;gt;*)$"
| table Time(utc) "OSVersion" host&lt;/LI-CODE&gt;&lt;P&gt;That will give you lists of OSVersions and hosts separately, but in a single table.&amp;nbsp; Then you should compare the time values to see if OSVersion and host are in events with the timestamp so they can be merged.&amp;nbsp; If so, then this query will do it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=teams ("osversion=" OR "host=12*")
| rex field=_raw "\s+(?&amp;lt;osVersion&amp;gt;.*?)$"
| rex field=_raw "\w+(?&amp;lt;host&amp;gt;*)$"
| stats values(*) as * by "Time(utc)"
| table "Time(utc)" "OSVersion" host&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 09 Oct 2024 16:13:07 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2024-10-09T16:13:07Z</dc:date>
    <item>
      <title>How to combain two rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combain-two-rex/m-p/701446#M237935</link>
      <description>&lt;P&gt;I have two rex queries and want know how to combine&lt;/P&gt;
&lt;P&gt;Query : 1&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=teams
| search "osversion="
| rex field=_raw "\s+(?&amp;lt;osVersion&amp;gt;.*?)$"
| table Time(utc) "OSVersion"

&lt;/LI-CODE&gt;
&lt;P&gt;output :&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;time&amp;nbsp; &amp;nbsp; &amp;nbsp; osversion&lt;BR /&gt;1.1 123&lt;BR /&gt;1.2 1234&lt;BR /&gt;1.3 12345&lt;BR /&gt;1.4 123456&lt;/P&gt;
&lt;P&gt;Query : 2&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=teams
| search "host=12*
| rex field=_raw "\w+(?&amp;lt;host&amp;gt;*)$"
| table Time(utc) "OSVersion"&lt;/LI-CODE&gt;
&lt;P&gt;output :&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;time&amp;nbsp; &amp;nbsp; &amp;nbsp; host&lt;BR /&gt;1.1 abc&lt;BR /&gt;1.2 abcd&lt;BR /&gt;1.3 abcde&lt;/P&gt;
&lt;P&gt;Pls help me how to combine above queries and should show table like below&lt;/P&gt;
&lt;P&gt;time&amp;nbsp; &amp;nbsp; &amp;nbsp; osversion&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host&lt;BR /&gt;1.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 123&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; abc&lt;BR /&gt;1.2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1234&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; abcd&lt;BR /&gt;1.3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; abcde&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 17:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combain-two-rex/m-p/701446#M237935</guid>
      <dc:creator>VRP136</dc:creator>
      <dc:date>2024-10-09T17:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to combain two rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combain-two-rex/m-p/701447#M237936</link>
      <description>&lt;P&gt;The queries can be combined like this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=teams ("osversion=" OR "host=12*")
| rex field=_raw "\s+(?&amp;lt;osVersion&amp;gt;.*?)$"
| rex field=_raw "\w+(?&amp;lt;host&amp;gt;*)$"
| table Time(utc) "OSVersion" host&lt;/LI-CODE&gt;&lt;P&gt;That will give you lists of OSVersions and hosts separately, but in a single table.&amp;nbsp; Then you should compare the time values to see if OSVersion and host are in events with the timestamp so they can be merged.&amp;nbsp; If so, then this query will do it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test1 sourcetype=teams ("osversion=" OR "host=12*")
| rex field=_raw "\s+(?&amp;lt;osVersion&amp;gt;.*?)$"
| rex field=_raw "\w+(?&amp;lt;host&amp;gt;*)$"
| stats values(*) as * by "Time(utc)"
| table "Time(utc)" "OSVersion" host&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 09 Oct 2024 16:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combain-two-rex/m-p/701447#M237936</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-10-09T16:13:07Z</dc:date>
    </item>
  </channel>
</rss>

