<?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: Regular expression in log message in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492866#M137462</link>
    <description>&lt;P&gt;If the number changes than the message is not the same. That is why you still see both messages. What you can do is a replace, to remove the number and than do the dedup. something like this based on the layout of the message field you provided:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval message=replace(message, "([^\d]*)(\d*\s*\d*\s*\d*)(.*)","\1\3")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 04 Oct 2019 08:44:11 GMT</pubDate>
    <dc:creator>aholzel</dc:creator>
    <dc:date>2019-10-04T08:44:11Z</dc:date>
    <item>
      <title>Regular expression in log message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492864#M137460</link>
      <description>&lt;P&gt;I'm struggling now.&lt;BR /&gt;
Could you please help me?&lt;/P&gt;

&lt;P&gt;There are two hosts. they have same log data.&lt;/P&gt;

&lt;P&gt;the host name is different but the same data is indexed.&lt;BR /&gt;
host 1 is the master.&lt;BR /&gt;
If host 1 fails, 2 becomes the master.&lt;/P&gt;

&lt;P&gt;If an alert is created as it is, two alerts will be created for the same event. So I am trying to make the same event into one using dedup.&lt;/P&gt;

&lt;P&gt;There is a message in the log, only the number changes.&lt;/P&gt;

&lt;P&gt;Error message ××× occur&lt;/P&gt;

&lt;P&gt;I want to create field to use dedup.&lt;BR /&gt;
I know it is wrong but I want to do like this one.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;message = "Error message \ d \ d \ d occur"
| dedup message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can't come up with a way.&lt;/P&gt;

&lt;P&gt;Could you help me?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 05:08:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492864#M137460</guid>
      <dc:creator>nanachu</dc:creator>
      <dc:date>2019-10-04T05:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression in log message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492865#M137461</link>
      <description>&lt;P&gt;Hi @nanachu &lt;/P&gt;

&lt;P&gt;Does what you state about the dedup not work as this should eliminate any duplicate messages and always just pick one from the first host? &lt;/P&gt;

&lt;P&gt;Also on the alert you can add a throttle so the same alert is not triggered twice?&lt;/P&gt;

&lt;P&gt;You also mentioned about regular expression in the log message. Do you mean you have created a regex to extract from the raw data t get this info? &lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 07:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492865#M137461</guid>
      <dc:creator>Sfry1981</dc:creator>
      <dc:date>2019-10-04T07:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression in log message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492866#M137462</link>
      <description>&lt;P&gt;If the number changes than the message is not the same. That is why you still see both messages. What you can do is a replace, to remove the number and than do the dedup. something like this based on the layout of the message field you provided:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval message=replace(message, "([^\d]*)(\d*\s*\d*\s*\d*)(.*)","\1\3")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Oct 2019 08:44:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492866#M137462</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2019-10-04T08:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression in log message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492867#M137463</link>
      <description>&lt;P&gt;Thank you for helping me.&lt;BR /&gt;
Sorry, my English is bad.&lt;/P&gt;

&lt;P&gt;I can not create field like &lt;BR /&gt;
because &lt;BR /&gt;
|eval message = "Error message * * * occur" does not work.&lt;BR /&gt;
so, I want to know how to create field that put a regular expression in message.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 08:51:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regular-expression-in-log-message/m-p/492867#M137463</guid>
      <dc:creator>nanachu</dc:creator>
      <dc:date>2019-10-04T08:51:55Z</dc:date>
    </item>
  </channel>
</rss>

