Zoomdata Version

Setting Up Activity Logging Using MongoDB

MongoDB can be used to record user- and server-based activities in its collection. Storing activity records in a MongoDB collection allows you to perform queries and create filters to search for specific activity records (which cannot be done in Log files). This article walks through setting up MongDB to record user activities and covers the following topics:

DEFAULT CONFIGURATIONs for the MongodB Activity Collection

The MongoDB 'activity' collection is created with the following configuration:

  • Collection size capped at 50 MB .
  • Collection is named 'activity' (which is not editable by the user)

Changing the default CONFIGURATIONS for MongoDB

You can change a collection's sizing constraints. This can be done either prior to or after installing the Zoomdata Server.

Prior to Zoomdata Installation

Prior to Zoomdata installation, you can change the default value of activity collection by adding the zoomdata.activity.capped.sizeMb property and specifying the required size to the zoomdata.properties file.

zoomdata.activity.capped.sizeMb= 60
Replace the number '60' with the required size of activity collection.

After Zoomdata Installation

If you want to change the size of capped collection after you have installed Zoomdata, you need to create a new collection , specify the required size, copy all the records to it , and finally remove the old one . Keep in mind that after you have created a new collection and copied the records to it, you must rename it to activity .

Enable/DISABLe ACTIVITY Recordkeeping TO MONGODB

Zoomdata Administrators with ' Supervisor ' credentials are able to edit the default configurations for the 'activity' collection. To enable activity recordkeeping to MongoDB, run the following cURL:

curl -u supervisor: password -XPUT 'http:// localhost:8080 /zoomdata/service/system/activity/DB ' -H "Content-Type: application/json"
--data ' true '

Replace the placeholders by the following values:

  • localhost:8080 - specify the address of the instance on which Zoomdata is installed
  • false - to disable the recordkeeping of all activities to the MongoDB collection
  • true - to enable the recordkeeping of all activities to the MongoDB collection

Enabling Activity Recordkeeping Globally

You have the ability to toggle on or off activity recordkeeping to the MongoDB 'activity' collection. Since logging is disabled by default, you can quickly do a global enable of all available activities* to be logged by running the following cURL command:

curl -u supervisor: password -XPUT 'http:// localhost:8080 /zoomdata/service/system/activity/DB ' -H "Content-Type: application/json" --data ' true '

Replace the following placeholders:

  • localhost:8080 - specify the address of the instance on which Zoomdata is installed
  • false - to disable the recordkeeping of all activities to the MongoDB collection
  • true - to enable the recordkeeping of all activities to the MongoDB collection
For a list of the activities that can be logged, refer to this Quick Reference Sheet .

To globally disable the recordkeeping of all activities to the 'activity' collection, run the cURL command with the data value set to 'false'.

Enabling Activity Logging By Activity Type

You can also enable the recordkeeping of specific activities. To do so, run the following cURL:

curl -u supervisor: password -XPUT 'http : // localhost:8080 /zoomdata/service/system/activity/type/ activityType /DB' -H "Content-Type: application/json" --data ' enabled '

Replace the following placeholders:

  • localhost:8080 - specify the address of the instance on which Zoomdata is installed
  • activityType - specify the type of selected activity* (for example, authentication and user )
  • enabled - value options: true/false - set the corresponding value to enable or disable selected activity output
*For a list of the activities that can be recorded, refer to this Quick Reference Sheet .

CHECK IF ACTIVITY Recordkeeping IS ENABLED FOR MongoDB

To check the status for activity recordkeeping to MongoDB, run the following cURL:

curl -u supervisor: password -XGET 'http:// localhost:8080 /zoomdata/service/system/activity/DB'

Replace the placeholder:

  • localhost:8080 - specify the address of the instance on which Zoomdata is installed

CHECK THE ACTIVITY records In MONGODB

In MongoDB, you can take the following actions with the 'activity' collection:

  • View the complete activity collection stored in MongoDB
  • Filter records by user name and account ID
  • Retrieve the records for a specified time period

Run the following cURL to view the records in the 'activity' collection for the required activity:

curl -u supervisor: password -XGET 'http:// localhost:8080 /zoomdata/service/system/activity/data/ activityType '

Replace the activityType placeholder by the activity type for which you want to view the collection of records.

For a list of the activities that can be logged, refer to this Quick Reference Sheet .

If you want to view the records for the activity type that is filtered by user name, account ID, or within a specified time period, run the following cURL:

curl -u supervisor: password -XGET 'http:// localhost:8080 /zoomdata/service/system/activity/data/ activityType ?user= userName &accountId= accountId &startDate= yyyy-MM-dd &endDate= yyyy-MM-dd '

Replace the following placeholders:

  • activityType -specify the type of selected activity. This parameter is required.

The parameters listed below are optional and can be used to filter the records in the log:

  • userName - filter by the specified user name
  • accountId - filter by the specified account ID
  • yyyy-MM-dd - show the records from the specified date
  • yyyy-MM-dd - show the records to the specified date

EXAMPLE:

curl -u supervisor: password -XGET 'http://localhost:8080/zoomdata/service/system/activity/data/ REQUEST ?user= admin &accountId= 64tr6ge6tikwjehr &startDate= 2016-01-01 &endDate= 2016-03-01 '