<?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 help with creating an alert when a field value changes in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494618#M8794</link>
    <description>&lt;P&gt;Hello All ,&lt;/P&gt;

&lt;P&gt;I have a field called version which has values 1,2 etc for each different field "collection" .Now I want to create an alert whenever the version value changes (always goes higher) from 1 to 2 or 2 to 3  .Once the value changes the new events will have the new version value .&lt;/P&gt;

&lt;P&gt;For instance for collection A the version is 1 ..in future if that value changes to 2 then the new data will have value 2 and so on&lt;/P&gt;

&lt;P&gt;SAMPLE EVENT&lt;/P&gt;

&lt;P&gt;{"fileName":"Bggg","id":"5d0d78","isChained":false,"metaInfo":{"author":"","copyright":"","description":"","name":"lin","noOutputFilesMessage":"","outputMessage":"","url":"","urlText":""},"packageType":1,"public":false,"runCount":4,"runDisabled":false,"subscriptionId":"5d013c84d3c465","uploadDate":"\/Date(1583943892366)\/","version":null,"workerTag":"","collections":[{"collectionId":"5dc909225c9e1a89","&lt;STRONG&gt;collectionName":"A"&lt;/STRONG&gt;}],"lastRunDate":"\/Date(1583948946000-0400)\/","publishedVersionId":"5e6910d3fa3a841ee8000611","&lt;STRONG&gt;publishedVersionNumber&lt;/STRONG&gt;":2,"publishedVersionOwner":{"active":true,"email":"aacom","firstName":"ha","id":"5d0136be14d3c398","lastName":"gi","sId":null,"subscriptionId":"5d0136be17c395"},"subscriptionName":"u"}&lt;/P&gt;

&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
    <pubDate>Wed, 11 Mar 2020 18:18:07 GMT</pubDate>
    <dc:creator>vrmandadi</dc:creator>
    <dc:date>2020-03-11T18:18:07Z</dc:date>
    <item>
      <title>help with creating an alert when a field value changes</title>
      <link>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494618#M8794</link>
      <description>&lt;P&gt;Hello All ,&lt;/P&gt;

&lt;P&gt;I have a field called version which has values 1,2 etc for each different field "collection" .Now I want to create an alert whenever the version value changes (always goes higher) from 1 to 2 or 2 to 3  .Once the value changes the new events will have the new version value .&lt;/P&gt;

&lt;P&gt;For instance for collection A the version is 1 ..in future if that value changes to 2 then the new data will have value 2 and so on&lt;/P&gt;

&lt;P&gt;SAMPLE EVENT&lt;/P&gt;

&lt;P&gt;{"fileName":"Bggg","id":"5d0d78","isChained":false,"metaInfo":{"author":"","copyright":"","description":"","name":"lin","noOutputFilesMessage":"","outputMessage":"","url":"","urlText":""},"packageType":1,"public":false,"runCount":4,"runDisabled":false,"subscriptionId":"5d013c84d3c465","uploadDate":"\/Date(1583943892366)\/","version":null,"workerTag":"","collections":[{"collectionId":"5dc909225c9e1a89","&lt;STRONG&gt;collectionName":"A"&lt;/STRONG&gt;}],"lastRunDate":"\/Date(1583948946000-0400)\/","publishedVersionId":"5e6910d3fa3a841ee8000611","&lt;STRONG&gt;publishedVersionNumber&lt;/STRONG&gt;":2,"publishedVersionOwner":{"active":true,"email":"aacom","firstName":"ha","id":"5d0136be14d3c398","lastName":"gi","sId":null,"subscriptionId":"5d0136be17c395"},"subscriptionName":"u"}&lt;/P&gt;

&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 18:18:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494618#M8794</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-03-11T18:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: help with creating an alert when a field value changes</title>
      <link>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494619#M8795</link>
      <description>&lt;P&gt;Hi @ vrmandadi,&lt;BR /&gt;
at first you have to extract the two files using a regex like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;collectionName\":\"(?&amp;lt;collectionName&amp;gt;[^\"]+)".*publishedVersionNumber\":(?&amp;lt;publishedVersionNumber&amp;gt;[^,]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/bTPcVJ/1"&gt;https://regex101.com/r/bTPcVJ/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;then you can run a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index
| rex "collectionName\":\"(?&amp;lt;collectionName&amp;gt;[^\"]+)".*publishedVersionNumber\":(?&amp;lt;publishedVersionNumber&amp;gt;[^,]+)"
| stats dc(publishedVersionNumber) AS number_of_versions values(publishedVersionNumber) AS publishedVersionNumber BY collectionName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you can create an alert adding to the end the row:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where number_of_versions&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or display the search in a panel as is.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 07:27:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494619#M8795</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-12T07:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: help with creating an alert when a field value changes</title>
      <link>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494620#M8796</link>
      <description>&lt;P&gt;Thank your response.This is not what I am looking for the version which changed from 1 to 2 in future will change to 3 ...SO the where clause needs to change everytime .I am looking for something like a compare thing which checks the version of a particular collect previously and check with latest and then generate an alert when there is a change&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494620#M8796</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2020-03-12T20:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: help with creating an alert when a field value changes</title>
      <link>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494621#M8797</link>
      <description>&lt;P&gt;Hi @ vrmandadi,&lt;BR /&gt;
sorry, I wasn't clear: using this search you don't search if the version of a collectionName has a value greather than 1 but you search if, in the monitoring period, there are two or more different versions for each of them, infact in the number_of_versions field there's ne number of different versions that you have using the distinct_count funtion.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:33:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/help-with-creating-an-alert-when-a-field-value-changes/m-p/494621#M8797</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T04:33:52Z</dc:date>
    </item>
  </channel>
</rss>

