Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device.
Atlassian cookies and tracking notice, (opens new window)
Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
/
How To - opEvents - Manually Purge Events From OMK Database
Updated Sept 22, 2021

    How To - opEvents - Manually Purge Events From OMK Database

    Sept 22, 2021
      • 1 Purpose
        • 1.1 Related Documents
      • 2 Determine Retention Interval
      • 3 Run the opEvents Purge Command
      • 4 Recover Disk Space - Compact MongoDB
        • 4.1 Shutdown OMK Services
        • 4.2 Enter the mongo Shell and Compact opEvents Collections
        • 4.3 Start OMK Services
      • 5 Set Purging Policy
      • 6 Related Topics

      Purpose

      Purging may not have been set up at installation time.  If the OMK database has grown large it's a good idea to select an event retention period and manually purge the OMK database.

      Related Documents

      Purging of old data in opEvents

      Determine Retention Interval

      Select a retention period that provides infrastructure engineers with necessary event information and also complies with your organizations security and compliance policies. 

      Run the opEvents Purge Command

      The purge action is run with the opevents-cli.exe command line utility.  When using this utility the retention period is relative to the current time and is referred to as 'purge_older_than'.  The value passed with the command may be expressed in minutes, hours, or days (combinations are also possible).  Using days as an example, if the retention period were 1 year the command line option for the retention period would like like this:

      ### Retention period events_purge_older_than_=365d ### Entire command /usr/local/omk/bin/opevents-cli.exe act=purge events_purge_older_than=365d

       

      We recommend running the purge in simulate mode first to determine if the desired outcome will be achieved. 

      For large databases this operation may take some time.

      [root@poller-office ~]# /usr/local/omk/bin/opevents-cli.exe act=purge events_purge_older_than=365d debug=1 simulate=true [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Purging unwanted database indices [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Purging disabled for rawlogs Purging disabled for rawlogs [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Purging disabled for archivelogs Purging disabled for archivelogs [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Db purge of events: 0 entries (of 17947) in events are older than 1y Db purge of events: 0 entries (of 17947) in events are older than 1y [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Simulated purging events: would remove 0 (of 17947) entries from events Simulated purging events: would remove 0 (of 17947) entries from events [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Db purge of events: 0 entries (of 13105) in actionlog are older than 1y Db purge of events: 0 entries (of 13105) in actionlog are older than 1y [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Simulated purging events: would remove 0 (of 13105) entries from actionlog Simulated purging events: would remove 0 (of 13105) entries from actionlog [Fri Dec 15 22:16:28 2017] [debug] cli[11499] Purging disabled for reports Purging disabled for reports

      Once satisfied that the desired action will occur; remove the simulate option and run the command again.

      Recover Disk Space - Compact MongoDB

      The old records have been removed, but the database is still taking the same amount of storage.  In order to recover the disk space we will need to issue the MongoDB 'compact' command.  This will rewrite and defragment the database. The safe approach is to shut down all daemons that are writing the the database prior to issuing the 'compact' command.

      Shutdown OMK Services

      service opeventsd stop service opflow stop service opconfigd stop service nmisd stop service omkd stop

      Enter the mongo Shell and Compact opEvents Collections

      [root@opmantek ~]# mongo -u opUserRW -p op42flow42 --authenticationDatabase=admin nmisng MongoDB shell version v3.4.9 connecting to: mongodb://127.0.0.1:27017/nmis MongoDB server version: 3.4.9 > db.runCommand({compact: 'events'}) { "ok" : 1 } > db.runCommand({compact: 'rawlogs'}) { "ok" : 1 > db.runCommand({compact: 'actionlog'}) { "ok" : 1 } >

      Start OMK Services

      service omkd start service nmisd start service opeventsd start service opconfigd start service opflowd start

      Set Purging Policy

      Now that the database has been cleaned up, set the purging policy in opCommon.  That procedure is found here: Purging of old data in opEvents

       

      Related Topics

      • Purging of old data in opEvents

        Community Home

        opEvents
        • Downloads
          Downloads
        Results will update as you type.
        • API
        • Archive Logging
        • Configuration
        • FAQ
        • Features
        • How-To Guides
          • Changing event colors based on priority level in opEvents
          • Create remote event
          • Creating custom Policies and Actions
          • How To - opEvents - Manually Purge Events From OMK Database
          • opEvents Customising Table Columns
          • opEvents Programmable Button Actions
          • opEvents - Solution Guide - Event Consolidation Based on Location
          • opEvents - Solution Guide - Sending Events to a Central Event Management Server
          • opEvents - Solution Guide - Setup Email Notifications and Other Actions
          • opEvents - Solution Guide - System Configuration for a Production Environment
          • opEvents - Syslog Handling - Adding a New Format
          • Opmantek Synergy - opEvents Triggers opConfig to Collect Targeted Diagnostic Data
          • Opsgenie Integration
          • Slack Integration
          • Enrich WAN Circuit Events
        • Introduction & Setup
        • opEvents Create filters for Current Events
        • opEvents Realtime Events
        • Parser Plugins using the opEvents object
        • Release Notes
        • opEvents Event Panels
          Questions
          Calendars

        You‘re viewing this with anonymous access, so some content might be blocked.
        {"serverDuration": 50, "requestCorrelationId": "ab6262f39f0748a887e6c31b493846a3"}