{"id":20445880,"url":"https://github.com/rapid7/r7insight_lambdas3","last_synced_at":"2025-07-02T07:05:44.565Z","repository":{"id":28629326,"uuid":"93619339","full_name":"rapid7/r7insight_lambdaS3","owner":"rapid7","description":"Lambda logging support for InsightOps","archived":false,"fork":false,"pushed_at":"2025-03-05T10:44:47.000Z","size":729,"stargazers_count":3,"open_issues_count":0,"forks_count":9,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-04-13T00:44:59.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rapid7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-06-07T09:49:01.000Z","updated_at":"2025-03-05T10:44:51.000Z","dependencies_parsed_at":"2024-01-24T17:51:37.178Z","dependency_job_id":"ab921c20-4eb7-4539-9b46-82c2fb863429","html_url":"https://github.com/rapid7/r7insight_lambdaS3","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rapid7/r7insight_lambdaS3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fr7insight_lambdaS3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fr7insight_lambdaS3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fr7insight_lambdaS3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fr7insight_lambdaS3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rapid7","download_url":"https://codeload.github.com/rapid7/r7insight_lambdaS3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fr7insight_lambdaS3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263091028,"owners_count":23412343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T10:15:11.113Z","updated_at":"2025-07-02T07:05:44.534Z","avatar_url":"https://github.com/rapid7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# r7insight_lambdaS3\nFollow the instructions below to send logs stored on AWS S3 to Rapid 7.\n\n###### Example use cases:\n* Forwarding AWS ELB and CloudFront logs\n  * (make sure to set ELB/CloudFront to write logs every 5 minutes)\n  * When forwarding these logs, the script will format the log lines according to Rapid 7 KVP or JSON spec to make them easier to analyze\n* Forwarding OpenDNS logs\n\n## Obtain log token\n1. Log in to your Rapid 7 account\n\n2. Add a new [token based log](https://insightops.help.rapid7.com/docs/token-tcp)\n\n## Deploy the script to AWS Lambda using AWS Console\n1. Create a new Lambda function\n\n2. Choose the appropriate Python blueprint for S3 objects\n\n   ![Choose Blueprint](doc/logging_from_s3_via_lambda_blueprint_selection.png)\n\n3. Configure function:\n   * Give your function a name\n   * Assign or create a new role that is allowing GetObject on necessary s3 bucket(s).\n   Note: Creating a new one automatically from this UI adds required permissions automatically`\n   \n4. Configure triggers:\n   * Choose the bucket log files are being stored in\n   * Set event type \"All object create events\"\n\n5. Click \"Create function\"\n\n6. Upload function code:\n   * Create a .ZIP file, containing ```r7insight_lambdas3.py``` and the folder ```certifi```\n     * Make sure the files and ```certifi``` folder are in the **root** of the ZIP archive\n   * Go to \"Code source\" section of lambda setup\n   * Choose \".zip file\" in \"Upload from\" dropdown and upload the archive created in previous step\n   * Set Python runtime version to ```Python 3.9``` by editing \"Runtime settings\" section \n   * Set handler name to ```r7insight_lambdas3.lambda_handler```\n   \n   Working example file structure:\n   ```\n    (root) - current AWS sets root directory name to your lambda function name automatically\n    ├── certifi/\n    │   ├── \n    │   ├── __init__.py\n    │   ├── __main__.py\n    │   ├── cacert.pem\n    │   ├── core.py\n    │   ├── old_root.pem\n    │   └── weak.pem\n    ├── r7insight_lambdas3.py`\n    ``\n   \n   `Note: Zip files downloaded via github puts all the files under a subdirectory; thefore, uploading the downloaded zip directly to AWS will not work.`\n\n7. Select configuration tab, edit \"General configuration\" to change memory and timeout limits\n\n8. Add the following Environment Variables:\n   * Token value should match UUID provided by Rapid 7 UI or API\n   * Region should be that of your R7 account\n\n   | Key       | Value                       |\n   |-----------|-----------------------------|\n   | region    | InsightOps region(eu,us etc)|\n   | token     | Token UUID                  |\n\n## Gotchas\n   * The \"Test\" execution in AWS Lambda will **ALWAYS** fail as the test event does not refer to an existing S3 object. In order to verify, upload a sample file to source bucket\n\n\n## 3rd party dependencies\n   * [python-certifi](https://github.com/certifi/python-certifi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapid7%2Fr7insight_lambdas3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapid7%2Fr7insight_lambdas3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapid7%2Fr7insight_lambdas3/lists"}