<?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: Regex not matching in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636284#M220977</link>
    <description>&lt;P&gt;It was because "Version" was empty. Fixed that in the script that populated the fields outside of splunk&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 10:17:52 GMT</pubDate>
    <dc:creator>michaelnorup</dc:creator>
    <dc:date>2023-03-28T10:17:52Z</dc:date>
    <item>
      <title>Why is my regex not matching?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636274#M220971</link>
      <description>&lt;P&gt;My regex from the message field looks like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex field=Message "\W(?&amp;lt;Hostname&amp;gt;\S+)\s\w+\W(?&amp;lt;Build&amp;gt;\S+)\s\w+\W(?&amp;lt;CpuCount&amp;gt;\S+)\s\w+\W(?&amp;lt;CpuTotalMhz&amp;gt;\S+)\s\w+\W(?&amp;lt;CpuUsageMhz&amp;gt;\S+)\s\w+\W(?&amp;lt;MemoryTotalMB&amp;gt;\S+)\s\w+\W(?&amp;lt;MemoryUsageMB&amp;gt;\S+)\s\w+\W(?&amp;lt;Version&amp;gt;\S+)" |&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;For some reason it matches and pulls out all the fields from this entry:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Message=Hostname=esx-pod1-nprd-112.mad.local Build=20842708 CPUCount=96 CpuTotalMhz=287232 CpuUsageMhz=142 MemoryTotalMB=1048094.5625 MemoryUsageMB=9086 Version=7.0.3&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;But not from any other entries which could looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Message=Hostname=10.241.192.46 Build=20842708 CPUCount=96 CpuTotalMhz=287232 CpuUsageMhz=8186 MemoryTotalMB=1048094.55859375 MemoryUsageMB=198624 Version=&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Message=Hostname=esx-cl6-184.mad.local Build=19195723 CPUCount=20 CpuTotalMhz=49880 CpuUsageMhz=672 MemoryTotalMB=294587.2578125 MemoryUsageMB=52530 Version=&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 14:30:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636274#M220971</guid>
      <dc:creator>michaelnorup</dc:creator>
      <dc:date>2023-03-28T14:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not matching</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636278#M220973</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237593"&gt;@michaelnorup&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try this...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval Message="Hostname=esx-pod1-nprd-112.mad.local Build=20842708 CPUCount=96 CpuTotalMhz=287232 CpuUsageMhz=142 MemoryTotalMB=1048094.5625 MemoryUsageMB=9086 Version=7.0.3,Hostname=10.241.192.46 Build=20842708 CPUCount=96 CpuTotalMhz=287232 CpuUsageMhz=8186 MemoryTotalMB=1048094.55859375 MemoryUsageMB=198624 Version=,Hostname=esx-cl6-184.mad.local Build=19195723 CPUCount=20 CpuTotalMhz=49880 CpuUsageMhz=672 MemoryTotalMB=294587.2578125 MemoryUsageMB=52530 Version="
| makemv Message delim=","
| mvexpand Message
| rex field=Message "Hostname\=(?&amp;lt;Hostname&amp;gt;[\w\-\.]+)\sBuild\=(?&amp;lt;Build&amp;gt;[\d]+)\sCPUCount\=(?P&amp;lt;CPUCount&amp;gt;[\d]+)\sCpuTotalMhz\=(?P&amp;lt;CpuTotalMhz&amp;gt;[\d]+)\sCpuUsageMhz\=(?P&amp;lt;CpuUsageMhz&amp;gt;[\d]+)\sMemoryTotalMB\=(?P&amp;lt;MemoryTotalMB&amp;gt;[\d\.]+)\sMemoryUsageMB\=(?P&amp;lt;MemoryUsageMB&amp;gt;[\d\.]+)\sVersion\=(?P&amp;lt;Version&amp;gt;.*)" 
| table Message Hostname Build CPUCount CpuTotalMhz CpuUsageMhz MemoryTotalMB MemoryUsageMB Version&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gr0und_Z3r0_0-1679997748717.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24574i1BEDC32ADEB16E55/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gr0und_Z3r0_0-1679997748717.png" alt="Gr0und_Z3r0_0-1679997748717.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;~ If the reply helps a karma vote would be appreciated&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 10:02:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636278#M220973</guid>
      <dc:creator>Gr0und_Z3r0</dc:creator>
      <dc:date>2023-03-28T10:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not matching</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636283#M220976</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237593"&gt;@michaelnorup&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please try this regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Message "Hostname\=(?&amp;lt;Hostname&amp;gt;[^ ]*)\s+Build\=(?&amp;lt;Build&amp;gt;[^ ]*)\s+CPUCount\=(?&amp;lt;CPUCount&amp;gt;[^ ]*)\s+CpuTotalMhz\=(?&amp;lt;CpuTotalMhz&amp;gt;[^ ]*)\s+CpuUsageMhz\=(?&amp;lt;CpuUsageMhz&amp;gt;[^ ]*)\s+MemoryTotalMB\=(?&amp;lt;MemoryTotalMB&amp;gt;[^ ]*)\s+MemoryUsageMB\=(?&amp;lt;MemoryUsageMB&amp;gt;[^ ]*)\s+Version\=(?&amp;lt;Version&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 10:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636283#M220976</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-28T10:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not matching</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636284#M220977</link>
      <description>&lt;P&gt;It was because "Version" was empty. Fixed that in the script that populated the fields outside of splunk&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 10:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636284#M220977</guid>
      <dc:creator>michaelnorup</dc:creator>
      <dc:date>2023-03-28T10:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not matching</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636291#M220979</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/240999"&gt;@Gr0und_Z3r0&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 10:35:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-regex-not-matching/m-p/636291#M220979</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-28T10:35:23Z</dc:date>
    </item>
  </channel>
</rss>

