{"id":909,"date":"2009-08-05T10:00:57","date_gmt":"2009-08-05T08:00:57","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=909"},"modified":"2009-07-25T11:53:57","modified_gmt":"2009-07-25T09:53:57","slug":"monitor-multiple-events-in-a-logfile-within-x-minutes","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=909","title":{"rendered":"Monitor multiple events in a logfile within X minutes"},"content":{"rendered":"<p>This is a example how you can configure a monitor to generate an alert if a log file contains a word more then X times during Y minutes. In the following example I have configure a monitor to generate a critical\u00c2\u00a0alert if the logfile contains &#8220;error&#8221; more then four times during a minute. The following example look in any file named logfile*.log in the C:\\logfiles folder. It the application writes a &#8220;success&#8221; to the logfile, the monitor will be reset back to healthy.<\/p>\n<p>1. Go to the Authoring workspace and create a new monitor, Log Files\/Text Log\/Repeated Event Detection\/Event Reset<\/p>\n<p>2. General<br \/>\nName: Contoso &#8211; Logfile &#8211; Repeated Event w event reset<br \/>\nMonitor Target: for example Windows Server 2008 Computer (more about targeting <a href=\"http:\/\/download.microsoft.com\/download\/f\/a\/7\/fa73e146-ab8a-4002-9311-bfe69a570d28\/BestPractices_Rule_Monitor_REV_110607.pdf\">here<\/a>\u00c2\u00a0and <a href=\"http:\/\/technet.microsoft.com\/en-us\/magazine\/2008.11.targeting.aspx?pr=blog\">here<\/a>)<br \/>\n&#8230;next<\/p>\n<p>3. Single Generic Log<br \/>\nDirectory: C:\\logfiles<br \/>\nPattern: logfile*.log<br \/>\n&#8230;next<\/p>\n<p>4. Single Event Expression<br \/>\nParameter Name: Params\/Param[1]<br \/>\nOperator: Contains<br \/>\nValue: success<br \/>\n&#8230;next<\/p>\n<p>5. Repeated Generic Log<br \/>\nDirectory: C:\\logfiles<br \/>\nPattern: logfile*.log<br \/>\n&#8230;next<\/p>\n<p>6. Repeated Event Expression<br \/>\nParameter Name: Params\/Param[1]<br \/>\nOperator: Contains<br \/>\nValue: error<br \/>\n&#8230;next<\/p>\n<p>7. Repeated Event Description<br \/>\nCounting mode: Trigger on count<br \/>\nCompare Count: 4<br \/>\nBased on items occurrence within a time interval: 1 Minutes<br \/>\n&#8230;next<\/p>\n<p style=\"text-align: center;\">\u00c2\u00a0<\/p>\n<p>8. Health<br \/>\nEvent Raised: Healthy<br \/>\nRepeated Event Raised: Critical<br \/>\n&#8230;next<\/p>\n<p>9. Alerting<br \/>\nCheck &#8220;Generate alerts for this monitor&#8221;<br \/>\nInput a suitable alert description, also try include a couple of the data parameters<br \/>\n&#8230;create<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2009\/07\/logevent03.JPG\"><\/a><\/p>\n<p>If any file named logfile*.log in the C:\\logfiles folder now writes four &#8220;error&#8221; within one minute an critical alert will generated. Then, if a &#8220;success&#8221; is any\u00c2\u00a0file the monitor will be set back to healthy state. Step 3 and 4 configure the event that will set the monitor back to healthy.<\/p>\n<div id='gallery-1' class='gallery galleryid-909 gallery-columns-3 gallery-size-thumbnail'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/contoso.se\/blog\/?attachment_id=924'><img width=\"150\" height=\"132\" src=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2009\/07\/logevent02-150x132.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/contoso.se\/blog\/?attachment_id=925'><img width=\"150\" height=\"150\" src=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2009\/07\/logevent03-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/contoso.se\/blog\/?attachment_id=918'><img width=\"150\" height=\"150\" src=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2009\/07\/logevent01-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/a>\n\t\t\t<\/div><\/figure>\n\t\t<\/div>\n\n<p>(click on a picture twice to enlarge it)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a example how you can configure a monitor to generate an alert if a log file contains a word more then X times during Y minutes. In the following example I have configure a monitor to generate a critical\u00c2\u00a0alert if the logfile contains &#8220;error&#8221; more then four times during a minute. The following &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=909\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[19],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/909"}],"collection":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=909"}],"version-history":[{"count":32,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/909\/revisions"}],"predecessor-version":[{"id":944,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/909\/revisions\/944"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}