<?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: Can you help me with the following regex please? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-regex-please/m-p/391836#M114064</link>
    <description>&lt;P&gt;Hi @jip31,&lt;/P&gt;

&lt;P&gt;Please try below search, replace &lt;CODE&gt;&amp;lt;FieldName&amp;gt;&lt;/CODE&gt; with actual field name.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=windows sourcetype="wineventlog:system" SourceName="Disk" count="$process$"
| dedup _time
| rex field=&amp;lt;FieldName&amp;gt; "\x5C\w+\x5C(?&amp;lt;extracted_disk&amp;gt;Harddisk(?:0|1))\x5CDR"
| where isnotnull(extracted_disk)
| table _time host Type EventCode extracted_disk
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you do not want extract &lt;CODE&gt;Harddisk0&lt;/CODE&gt; OR &lt;CODE&gt;Harddisk1&lt;/CODE&gt; in another field and only want to filter result based on those Harddisk value then use &lt;CODE&gt;regex&lt;/CODE&gt; command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=windows sourcetype="wineventlog:system" SourceName="Disk" count="$process$"
| dedup _time
| regex &amp;lt;FieldName&amp;gt;="\x5C\w+\x5C(Harddisk(?:0|1))\x5CDR"
| table _time host Type EventCode
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 13 Nov 2018 09:43:46 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2018-11-13T09:43:46Z</dc:date>
    <item>
      <title>Can you help me with the following regex please?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-regex-please/m-p/391834#M114062</link>
      <description>&lt;P&gt;hi&lt;/P&gt;

&lt;P&gt;I want to add a rex field in my search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=windows sourcetype="wineventlog:system" SourceName="Disk" count="$process$"
  | dedup _time
| table _time host Type EventCode
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are 2 conditions for my rex field :&lt;/P&gt;

&lt;P&gt;Une erreur a été détectée sur le périphérique \Device\Harddisk1\DR1 lors d'une opération de pagination. &lt;/P&gt;

&lt;P&gt;\Harddisk\ has to finish by 0 or 1, but not by another number.&lt;/P&gt;

&lt;P&gt;After \Harddisk0\ or \Harddisk1\ it's mandatory to have DR&lt;/P&gt;

&lt;P&gt;Could you help me please??&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 09:29:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-regex-please/m-p/391834#M114062</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-11-13T09:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following regex please?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-regex-please/m-p/391835#M114063</link>
      <description>&lt;P&gt;Try this if you want to use the regex command to search for events that match those conditions:&lt;BR /&gt;
&lt;CODE&gt;| regex "\\Harddisk[0-1]\\DR"&lt;/CODE&gt;&lt;BR /&gt;
&lt;A href="https://regex101.com/r/F6AExN/1"&gt;https://regex101.com/r/F6AExN/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Try this if you want to use the rex command to extract the harddiskname (only those matching your conditions):&lt;BR /&gt;
&lt;CODE&gt;| rex "\\(?&amp;lt;diskName&amp;gt;Harddisk[0-1])\\DR"&lt;/CODE&gt;&lt;BR /&gt;
&lt;A href="https://regex101.com/r/F6AExN/2"&gt;https://regex101.com/r/F6AExN/2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 09:42:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-regex-please/m-p/391835#M114063</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-11-13T09:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with the following regex please?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-regex-please/m-p/391836#M114064</link>
      <description>&lt;P&gt;Hi @jip31,&lt;/P&gt;

&lt;P&gt;Please try below search, replace &lt;CODE&gt;&amp;lt;FieldName&amp;gt;&lt;/CODE&gt; with actual field name.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=windows sourcetype="wineventlog:system" SourceName="Disk" count="$process$"
| dedup _time
| rex field=&amp;lt;FieldName&amp;gt; "\x5C\w+\x5C(?&amp;lt;extracted_disk&amp;gt;Harddisk(?:0|1))\x5CDR"
| where isnotnull(extracted_disk)
| table _time host Type EventCode extracted_disk
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you do not want extract &lt;CODE&gt;Harddisk0&lt;/CODE&gt; OR &lt;CODE&gt;Harddisk1&lt;/CODE&gt; in another field and only want to filter result based on those Harddisk value then use &lt;CODE&gt;regex&lt;/CODE&gt; command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=windows sourcetype="wineventlog:system" SourceName="Disk" count="$process$"
| dedup _time
| regex &amp;lt;FieldName&amp;gt;="\x5C\w+\x5C(Harddisk(?:0|1))\x5CDR"
| table _time host Type EventCode
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Nov 2018 09:43:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-with-the-following-regex-please/m-p/391836#M114064</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-11-13T09:43:46Z</dc:date>
    </item>
  </channel>
</rss>

