MongoDB Log
MongoDB Pack.#
This Integration is part of the#
OverviewWrites log data to a MongoDB collection. This integration was integrated and tested with version v4.2.3 of MongoDB.
The account user must have appropriate permissions - root role to execute the API calls.
#
Use Cases- Write to MongoDB Log collection.
- Read from MongoDB log collection.
- Get the number of log entries.
#
Configure MongoDB Log on Demisto- Navigate to Settings > Integrations > Servers & Services.
- Search for MongoDB Log.
- Click Add instance to create and configure a new integration instance.
- Name: a textual name for the integration instance.
- MongoDB Username
- URI (mongodb://IP/FQDN:Port Number)
- Database Name
- Collection Name
- Trust any certificate (not secure)
- Use SSL/TLS secured connection
- Click Test to validate the URLs, token, and connection.
#
CommandsYou can execute these commands from the Demisto CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.
- mongodb-read-log
- mongodb-write-log
- mongodb-logs-number
#
1. mongodb-read-logReturns all log entries.
#
Base Commandmongodb-read-log
#
InputArgument Name | Description | Required |
---|---|---|
limit | The maximum number of logs to return. | Optional |
#
Context OutputThere is no context output for this command.
#
Command Example!mongodb-read-log limit=5
#
Human Readable Output#
The log documents/records for collection "log"log |
---|
{'name': 'Midhuna', 'age': 23, 'cars': ['BMW 320d', 'Audi R8'], 'place': 'Amaravati'},{'timestamp': '2020-03-22T18:57:33+00:00', 'entity': 'test', 'playbook': 'my playbook', 'action': 'create', 'analyst': 'admin'},{'test': 'value'},{'123': {'modified': '2020-03-22T19:14:29+00:00', 'key': 'test', 'value': '123'}},{'timestamp': '2020-03-23T10:45:39+00:00', 'entity': '{test: demisto}', 'playbook': 'mongodb', 'action': 'create', 'analyst': 'admin'} |
#
2. mongodb-write-logAdds a log entry.
#
Base Commandmongodb-write-log
#
InputArgument Name | Description | Required |
---|---|---|
playbook | The playbook that was used. | Optional |
user | The assigned user. | Optional |
id | Entity to write to the log. | Optional |
action | The actions that were performed. | Optional |
message | Message for the entry. | Optional |
#
Context OutputPath | Type | Description |
---|---|---|
MongoDB.Entry.Action | String | The actions that were performed. |
MongoDB.Entry.User | String | Assigned analyst. |
MongoDB.Entry.ID | String | Entity to write to the log. |
MongoDB.Entry.EntryID | String | Entry ID. |
MongoDB.Entry.Playbook | String | The playbook that was used. |
MongoDB.Entry.Timestamp | Date | Entry timestamp. |
MongoDB.Entry.Message | String | The message of the entry. |
#
Command Example!mongodb-write-log action=create message="This is a test message"
#
Context Example#
Human Readable OutputMongoDB Log - 1 document/record added
#
3. mongodb-logs-numberReturns the number of log entries.
#
Base Commandmongodb-logs-number
#
InputThere are no input arguments for this command.
#
Context OutputThere is no context output for this command.
#
Command Example!mongodb-logs-number
#
Human Readable OutputThe count of log documents/records is 56