{"id":2386,"date":"2011-06-14T06:42:35","date_gmt":"2011-06-14T04:42:35","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=2386"},"modified":"2011-06-14T09:43:44","modified_gmt":"2011-06-14T07:43:44","slug":"opalis-log-purging","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=2386","title":{"rendered":"Opalis Log Purging"},"content":{"rendered":"<p>If your Opalis database is filled up with log entries the console performance will be affected. Navigating between folders in the console, viewing workflows or console \u00e2\u20ac\u0153hangs\u00e2\u20ac\u009d in general can be a result of to much log data in the database.By default the log purging feature is not enable in Opalis. The result of that is that no historical data is ever removed from the Opalis database, unless it is manually configured and then either executed by clicking on the \u00e2\u20ac\u0153Purge Now\u00e2\u20ac\u009d button, or scheduled by selecting the \u00e2\u20ac\u0153Schedule Log Purge\u00e2\u20ac\u009d. In this post I will share some common practices around log purging and database maintenance for the Opalis database. The Log Purge Configuration dialog box can be accessed from the Opalis Integration Server Client by right-click and selecting Log Purge on server name in the navigation pane.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge01.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2387\" title=\"opalis_purge01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge01-300x199.jpg\" alt=\"\" width=\"300\" height=\"199\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge01-300x199.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge01.jpg 596w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The purge feature will purge data from following three tables in the Opalis database<\/p>\n<ul>\n<li>Policyinstances<\/li>\n<li>Objectinstances<\/li>\n<li>Objectinstancedata<\/li>\n<\/ul>\n<p>When working with the Opalis Integration Server Client you can review historical data in a couple of places<\/p>\n<ul>\n<li>The log tab, show you running policy instances<\/li>\n<li>The log history tab, will show you information on policy instances that have completed<\/li>\n<li>The Audit History tab will show changes made to a policy grouped by each time you click \u00e2\u20ac\u0153check\u00e2\u20ac\u201din\u00e2\u20ac\u009d<\/li>\n<li>The Events tab will show you events from Opalis, for example if you use the Send Platform Event activity within a policy<\/li>\n<\/ul>\n<p>Both the Log tab and the Log History tab show you data from these three tables.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge02.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2389\" title=\"opalis_purge02\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge02-300x251.jpg\" alt=\"\" width=\"300\" height=\"251\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge02-300x251.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge02.jpg 370w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Both views, Log and Log History, show selected data from the POLCIINSTANCES table. When you click on a log entry, data for the objects in that policy instance are shown from the OBJECTINSTANCES table. When selecting an object, data for that object is read from the OBJECTINSTANCEDATA table.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge03.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2390\" title=\"opalis_purge03\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge03-300x89.jpg\" alt=\"\" width=\"300\" height=\"89\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge03-300x89.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge03.jpg 522w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge04.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2391\" title=\"opalis_purge04\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge04-300x222.jpg\" alt=\"\" width=\"300\" height=\"222\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge04-300x222.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge04.jpg 421w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge05.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2392\" title=\"opalis_purge05\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge05-300x221.jpg\" alt=\"\" width=\"300\" height=\"221\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge05-300x221.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge05.jpg 426w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The following query can be used to list Policy ID, Policy Name, SeqNumber, Action Server and Number of Instances. The Number of Instances is the indicator how often the Action Server executed the policy since the last log purge. This query is very helpful to see what policy is filling up your tables with historical data.<br \/>\n<code>SELECT<br \/>\n[p].[UniqueID] AS [Policy ID],<br \/>\n[p].[Name] AS [Policy Name],<br \/>\n[prq].[SeqNumber],<br \/>\n[a].[Computer] AS [Action Server],<br \/>\nCOUNT([pi].[UniqueID]) AS [Number Of Instances]<br \/>\nFROM        [POLICY_REQUEST_HISTORY] AS prq<br \/>\nINNER JOIN  [POLICIES] AS p ON [prq].[PolicyID] = [p].[UniqueID]<br \/>\nINNER JOIN  [POLICYINSTANCES] AS [pi] ON [prq].[SeqNumber] = [pi].[SeqNumber]<br \/>\nINNER JOIN  [ACTIONSERVERS] AS a ON [pi].[ActionServer] = [a].[UniqueID]<br \/>\nWHERE<br \/>\n[prq].[Active] = 1 AND<br \/>\n[pi].[TimeEnded] IS NOT NULL<br \/>\nGROUP BY<br \/>\n[p].[UniqueID],<br \/>\n[p].[Name],<br \/>\n[prq].[SeqNumber],<br \/>\n[a].[Computer]<br \/>\nORDER BY<br \/>\n[Number Of Instances] DESC<\/code><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge06.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2393\" title=\"opalis_purge06\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge06-300x226.jpg\" alt=\"\" width=\"300\" height=\"226\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge06-300x226.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/06\/opalis_purge06.jpg 752w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Regarding backup of the Opalis database I have seen a couple of different solutions. The first solution is to export all policies and global settings. This will give you a simple way to restore, re-import the export files. You can do a quick re-install of the Opalis environment and import the files in case of a disaster. You can include the export part in your change management process; before you import a new policy into Opalis you also make a backup copy.<\/p>\n<p>The second solution is to do a backup of the database; an advantage with this solution is that you keep all the historical data. But if you restore the database from a backup when there were policies running, you can run into some problem with state data. But you could execute the sp_StopAllRequests stored procedure to clear out any active requests and instances that aren\u00e2\u20ac\u2122t desired. The restore process gets a little bit more complicated with the second solution.<\/p>\n<p>With the first backup solution I recommend you, and that is a general recommendation, to keep state data\/historical data in an external data store. For example we could use Service Manager to track what is happening. Opalis executes and Service Manager remembers. As soon as Opalis is done, it will drop everything, it only keeps it in memory during execution (and maybe some logs). Working with Service Manager will give us a great way to track everything. It could of course be any system that we can integrate with, for example an extra SQL database.<\/p>\n<p>Thanks to my colleague Robert Riedmaier for sharing his deep knowledge around Opalis log purge, backup and database maintenance. Thanks Robert!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If your Opalis database is filled up with log entries the console performance will be affected. Navigating between folders in the console, viewing workflows or console \u00e2\u20ac\u0153hangs\u00e2\u20ac\u009d in general can be a result of to much log data in the database.By default the log purging feature is not enable in Opalis. The result of that &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=2386\">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":[58],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2386"}],"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=2386"}],"version-history":[{"count":5,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2386\/revisions"}],"predecessor-version":[{"id":2397,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2386\/revisions\/2397"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}