# sumologic-mongodb-atlas
Solution to pull alerts from Mongo DB Atlas to Sumo Logic
## Installation
This collector can be deployed both onprem and on cloud.
### Deploying the collector on a VM
1. Get Authentication information from the MongoDB Atlas portal
* Generate Programmatic API Keys with Project owner permissions using the instructions in the Atlas docs. Copy the Public Key and Private Key. These serve the same function as a username and API Key respectively. Note: If you want to use the AWS Lambda function for collection, do not Select Add Whitelist Entry.
* Go to your project and then click on settings. Copy the project ID as shown below:
* Go to your organization by using context drop down at the top. Then click on settings and copy the organization ID.
2. Add a Hosted Collector and one HTTP Logs and Metrics Source
* To create a new Sumo Logic Hosted Collector, perform the steps in [Configure a Hosted Collector](https://help.sumologic.com/03Send-Data/Hosted-Collectors/Configure-a-Hosted-Collector).
* Add an [HTTP Logs and Metrics Source](https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/HTTP-Source). Under Advanced you'll see options regarding timestamps and time zones and when you select Timestamp parsing specify the custom time stamp format as shown below:
- Format: `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`
- Timestamp locator: `\"created\": (.*),`.
* Add another HTTP Source this time for metric
3. Method 1 - Configuring the **sumologic-mongodbatlas** collector
Below instructions assume pip is already installed if not then, see the pip [docs](https://pip.pypa.io/en/stable/installing/) on how to download and install pip.
*sumologic-mongodbatlas* is compatible with python 3.7 and python 2.7. It has been tested on Ubuntu 18.04 LTS and Debian 4.9.130.
Login to a Linux machine and download and follow the below steps:
* Install the collector using below command
``` pip install sumologic-mongodbatlas```
* Create a configuration file named mongodbatlas.yaml in home directory by copying the below snippet.
```
SumoLogic:
HTTP_LOGS_ENDPOINT: <Paste the URL for the HTTP Logs source from step 2.>
HTTP_METRICS_ENDPOINT: <Paste the URL for the HTTP Metrics source from step 2.>
MongoDBAtlas:
ORGANIZATION_ID: Paste the Organization ID from step 1.
PROJECT_ID: Paste the Project ID from step 1.
PRIVATE_API_KEY: Paste the Private Key from step 1.
PUBLIC_API_KEY: Paste the Public Key from step 1.
```
* Create a cron job for running the collector every 5 minutes by using the crontab -e and adding the below line
`*/5 * * * * /usr/bin/python -m sumomongodbatlascollector.main > /dev/null 2>&1`
Method 2 - Collection via an AWS Lambda function
To install Sumo Logic’s AWS Lambda script, follow the instructions below:
* Go to https://serverlessrepo.aws.amazon.com/applications
Search for “sumologic-mongodb-atlas” and select the app as shown below:
* When the page for the Sumo app appears as shown below, click the Deploy button as shown below:
* In the Configure application parameters panel, shown below:
* HTTPLogsEndpoint: Paste the URL for the HTTP Logs source from step 2.
* HTTPMetricsEndpoint: Paste the URL for the HTTP Metrics source from step 2.
* OrganizationID: Paste the Organization ID from step 1.
* ProjectID: Paste the Project ID from step 1.
* Private API Key: Paste the Private Key from step 1.
* Public API Key: Paste the Public Key from step 1.
* Click Deploy.
* Whitelisting Lambda's IP Address
* Search for Lambda in the AWS console, select Functions tab and open the function just created.
* Go to the Configuration>Permissions tab of the function>click on the Execution role name link to open up the IAM window containing all the permission policies.
* Click on Add permissions>Create inline policy. Choose JSON and copy this policy statement:
```
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:DescribeNetworkInterfaces", "ec2:CreateNetworkInterface", "ec2:DeleteNetworkInterface", "ec2:DescribeInstances", "ec2:AttachNetworkInterface" ], "Resource": "*" } ] }
```
Click on Review policy>give an appropriate name>click on Create policy.
Some users might already have these permissions enabled.
* We then [follow these steps](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/generate-a-static-outbound-ip-address-using-a-lambda-function-amazon-vpc-and-a-serverless-architecture.html) to create elastic ip/ips for the lambda function and add a vpc to our function. We note down the elastic ips.
* We go to the mongo console>click on Organization Access>Access Manager>API Keys>click on ‘...’ of the API Key used above>Edit Permissions.
* Click Next>Add Access List Entry>Enter the elastic ips noted above and save>Done.
* The lambda function should be working now in sending logs to Sumo. You can check the cloudwatch logs in Monitor>Logs to see the logs of the function.
Raw data
{
"_id": null,
"home_page": "https://github.com/SumoLogic/sumologic-mongodb-atlas",
"name": "sumologic-mongodb-atlas",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "sumologic python rest api log management analytics logreduce mongodb atlas agent security siem collector forwarder",
"author": "SumoLogic",
"author_email": "it@sumologic.com",
"download_url": "https://files.pythonhosted.org/packages/63/88/9d016439c458d8501ed9f8a1eedeeb4f440bab18c21ff377047bd250ba03/sumologic_mongodb_atlas-1.0.11.tar.gz",
"platform": null,
"description": "# sumologic-mongodb-atlas\n\nSolution to pull alerts from Mongo DB Atlas to Sumo Logic\n\n\n## Installation\n\nThis collector can be deployed both onprem and on cloud.\n\n\n### Deploying the collector on a VM\n1. Get Authentication information from the MongoDB Atlas portal\n * Generate Programmatic API Keys with Project owner permissions using the instructions in the Atlas docs. Copy the Public Key and Private Key. These serve the same function as a username and API Key respectively. Note: If you want to use the AWS Lambda function for collection, do not Select Add Whitelist Entry.\n * Go to your project and then click on settings. Copy the project ID as shown below:\n\n * Go to your organization by using context drop down at the top. Then click on settings and copy the organization ID.\n\n\n2. Add a Hosted Collector and one HTTP Logs and Metrics Source\n\n * To create a new Sumo Logic Hosted Collector, perform the steps in [Configure a Hosted Collector](https://help.sumologic.com/03Send-Data/Hosted-Collectors/Configure-a-Hosted-Collector).\n * Add an [HTTP Logs and Metrics Source](https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/HTTP-Source). Under Advanced you'll see options regarding timestamps and time zones and when you select Timestamp parsing specify the custom time stamp format as shown below:\n - Format: `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`\n - Timestamp locator: `\\\"created\\\": (.*),`.\n * Add another HTTP Source this time for metric\n\n3. Method 1 - Configuring the **sumologic-mongodbatlas** collector\n\n Below instructions assume pip is already installed if not then, see the pip [docs](https://pip.pypa.io/en/stable/installing/) on how to download and install pip.\n *sumologic-mongodbatlas* is compatible with python 3.7 and python 2.7. It has been tested on Ubuntu 18.04 LTS and Debian 4.9.130.\n Login to a Linux machine and download and follow the below steps:\n\n * Install the collector using below command\n ``` pip install sumologic-mongodbatlas```\n\n * Create a configuration file named mongodbatlas.yaml in home directory by copying the below snippet.\n\n ```\n SumoLogic:\n HTTP_LOGS_ENDPOINT: <Paste the URL for the HTTP Logs source from step 2.>\n HTTP_METRICS_ENDPOINT: <Paste the URL for the HTTP Metrics source from step 2.>\n\n MongoDBAtlas:\n ORGANIZATION_ID: Paste the Organization ID from step 1.\n PROJECT_ID: Paste the Project ID from step 1.\n PRIVATE_API_KEY: Paste the Private Key from step 1.\n PUBLIC_API_KEY: Paste the Public Key from step 1.\n ```\n * Create a cron job for running the collector every 5 minutes by using the crontab -e and adding the below line\n\n `*/5 * * * * /usr/bin/python -m sumomongodbatlascollector.main > /dev/null 2>&1`\n\n Method 2 - Collection via an AWS Lambda function\n To install Sumo Logic\u2019s AWS Lambda script, follow the instructions below:\n\n * Go to https://serverlessrepo.aws.amazon.com/applications\nSearch for \u201csumologic-mongodb-atlas\u201d and select the app as shown below:\n\n * When the page for the Sumo app appears as shown below, click the Deploy button as shown below:\n\n\n * In the Configure application parameters panel, shown below:\n\n * HTTPLogsEndpoint: Paste the URL for the HTTP Logs source from step 2.\n * HTTPMetricsEndpoint: Paste the URL for the HTTP Metrics source from step 2.\n * OrganizationID: Paste the Organization ID from step 1.\n * ProjectID: Paste the Project ID from step 1.\n * Private API Key: Paste the Private Key from step 1.\n * Public API Key: Paste the Public Key from step 1.\n * Click Deploy.\n * Whitelisting Lambda's IP Address\n * Search for Lambda in the AWS console, select Functions tab and open the function just created.\n * Go to the Configuration>Permissions tab of the function>click on the Execution role name link to open up the IAM window containing all the permission policies.\n * Click on Add permissions>Create inline policy. Choose JSON and copy this policy statement:\n ```\n { \"Version\": \"2012-10-17\", \"Statement\": [ { \"Effect\": \"Allow\", \"Action\": [ \"ec2:DescribeNetworkInterfaces\", \"ec2:CreateNetworkInterface\", \"ec2:DeleteNetworkInterface\", \"ec2:DescribeInstances\", \"ec2:AttachNetworkInterface\" ], \"Resource\": \"*\" } ] }\n ```\n Click on Review policy>give an appropriate name>click on Create policy.\n Some users might already have these permissions enabled.\n * We then [follow these steps](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/generate-a-static-outbound-ip-address-using-a-lambda-function-amazon-vpc-and-a-serverless-architecture.html) to create elastic ip/ips for the lambda function and add a vpc to our function. We note down the elastic ips.\n * We go to the mongo console>click on Organization Access>Access Manager>API Keys>click on \u2018...\u2019 of the API Key used above>Edit Permissions.\n * Click Next>Add Access List Entry>Enter the elastic ips noted above and save>Done.\n * The lambda function should be working now in sending logs to Sumo. You can check the cloudwatch logs in Monitor>Logs to see the logs of the function.\n",
"bugtrack_url": null,
"license": "PSF",
"summary": "Sumo Logic collection solution for mongodb atlas",
"version": "1.0.11",
"project_urls": {
"Homepage": "https://github.com/SumoLogic/sumologic-mongodb-atlas"
},
"split_keywords": [
"sumologic",
"python",
"rest",
"api",
"log",
"management",
"analytics",
"logreduce",
"mongodb",
"atlas",
"agent",
"security",
"siem",
"collector",
"forwarder"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "003b27b63f2cb30b747c93085f6eb2a85b9e22e12f5e5d808dd4fa2aed11e0a6",
"md5": "b90b278795ce4547626339bc8ea4797f",
"sha256": "2749d78f525df7b662ce2071eee2c1256be589769c86db17ff2236fbe365e009"
},
"downloads": -1,
"filename": "sumologic_mongodb_atlas-1.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b90b278795ce4547626339bc8ea4797f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 22065,
"upload_time": "2024-11-08T17:13:08",
"upload_time_iso_8601": "2024-11-08T17:13:08.733296Z",
"url": "https://files.pythonhosted.org/packages/00/3b/27b63f2cb30b747c93085f6eb2a85b9e22e12f5e5d808dd4fa2aed11e0a6/sumologic_mongodb_atlas-1.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "63889d016439c458d8501ed9f8a1eedeeb4f440bab18c21ff377047bd250ba03",
"md5": "1843d08f17e7fbaf12992dcc2879e7ba",
"sha256": "fc2e49bed181ced073154f223c15542d3cdfa8c77833950d411fb7065c424341"
},
"downloads": -1,
"filename": "sumologic_mongodb_atlas-1.0.11.tar.gz",
"has_sig": false,
"md5_digest": "1843d08f17e7fbaf12992dcc2879e7ba",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20593,
"upload_time": "2024-11-08T17:13:10",
"upload_time_iso_8601": "2024-11-08T17:13:10.564813Z",
"url": "https://files.pythonhosted.org/packages/63/88/9d016439c458d8501ed9f8a1eedeeb4f440bab18c21ff377047bd250ba03/sumologic_mongodb_atlas-1.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-08 17:13:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SumoLogic",
"github_project": "sumologic-mongodb-atlas",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "sumologic-mongodb-atlas"
}