{"id":281,"date":"2008-06-15T11:10:20","date_gmt":"2008-06-15T09:10:20","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=281"},"modified":"2008-06-15T11:10:20","modified_gmt":"2008-06-15T09:10:20","slug":"ops-mgr-and-log-files","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=281","title":{"rendered":"Ops Mgr and Log Files"},"content":{"rendered":"<p>There has been some discussions about monitoring log files and how Ops Mgr handle them. I did some tests in my sandbox regarding this. I created a monitor to check log files with pattern &#8220;*.log*&#8221; in C:\\AppLogs\\. Ops Mgr is looking for &#8220;warning&#8221; in all .log files. As soon as I input &#8220;warning&#8221; in my log file applog.log I get an alert in the console. You can use the variables below to add information to the alert description, for example\u00c2\u00a0the filename.<\/p>\n<p>Logfile Directory : $Data\/EventData\/DataItem\/LogFileDirectory$<br \/>\nLogfile name: $Data\/EventData\/DataItem\/LogFileName$<br \/>\nString:\u00c2\u00a0 $Data\/EventData\/DataItem\/Params\/Param[1]$<\/p>\n<p>If I clear the logfile and then input &#8220;warning&#8221;, I don\u00c2\u00b4t get an alert. Ops Mgr remember where it read last time and will not read the hole file again, and as I am back on line one now, Ops Mgr consider that line as read. But if I add a couple of more lines Ops Mgr will generate an alert as I am beyond that line where Ops Mgr read last time.<\/p>\n<p>If I add a second log file to the same directory, for example applog2.log, and input &#8220;warning&#8221; in it I get an alert instant.<\/p>\n<p>Summary: If you want to limit the space that your log file needs, configure your application to use multiple log files, instead of clear the log file. For example configure your application to start a new log file every hour or day. Make sure the application are not updating the old files after a new is created. As long as the log file name patter is the same Ops Mgr will find it and monitor it, without any extra configuration.\u00c2\u00a0You can then configure another rule to delete old log files to clear up space.<\/p>\n<p>I have note that sometimes, if you are monitoring a number of files that all are all active, the monitor health state will change after the first\u00c2\u00a0new &#8220;warning&#8221;, if you then get a new &#8220;warning&#8221; in a log file before the monitor is back to health you will not see that second &#8220;warning&#8221;\u00c2\u00a0in the console.\u00c2\u00a0Also note that\u00c2\u00a0log file monitors are not case sensitive, so if you configure it to look for Warning it will\u00c2\u00a0also trigger on warning.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There has been some discussions about monitoring log files and how Ops Mgr handle them. I did some tests in my sandbox regarding this. I created a monitor to check log files with pattern &#8220;*.log*&#8221; in C:\\AppLogs\\. Ops Mgr is looking for &#8220;warning&#8221; in all .log files. As soon as I input &#8220;warning&#8221; in my &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=281\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","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\/281"}],"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=281"}],"version-history":[{"count":0,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}