From 079da4475eeeafe2b2edbeb1c753c54909bdb80e Mon Sep 17 00:00:00 2001 From: chrystinne Date: Thu, 19 Oct 2023 16:30:53 -0400 Subject: [PATCH] Configure server access logging for an S3 bucket. This enables access logging, directing logs to the specified target bucket and prefix. --- .env.example | 3 + .../console/manage_published_project.html | 2 +- physionet-django/console/views.py | 10 +- physionet-django/physionet/settings/base.py | 4 + physionet-django/project/cloud/s3.py | 498 ++++++++++-------- 5 files changed, 288 insertions(+), 229 deletions(-) diff --git a/.env.example b/.env.example index 3ebac56023..12c08093a8 100644 --- a/.env.example +++ b/.env.example @@ -62,11 +62,14 @@ AWS_CLOUD_FORMATION=url # AWS credentials (Access Key and Secret Key): Configure AWS credentials in the AWS CLI profile using the 'aws configure' command. AWS_PROFILE= +AWS_ACCOUNT_ID= # Path to the file containing credentials for AWS # (https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#shared-credentials-file) AWS_SHARED_CREDENTIALS_FILE= # The default bucket name to store projects with an 'OPEN' access policy. S3_OPEN_ACCESS_BUCKET= +# The default bucket name to store logs and metrics related to project usage. +S3_SERVER_ACCESS_LOGS= # Datacite # Used to assign the DOIs diff --git a/physionet-django/console/templates/console/manage_published_project.html b/physionet-django/console/templates/console/manage_published_project.html index 7700cdda73..fda1899ba0 100644 --- a/physionet-django/console/templates/console/manage_published_project.html +++ b/physionet-django/console/templates/console/manage_published_project.html @@ -417,7 +417,7 @@
AWS
are set.)

{% elif not project.aws.bucket_name %} -

Create a bucket on AWS to store the files associated with this project. dsjkbjak {{project.id}} {{project.aws.bucket_name}} {{project.aws.sent_files}}

+

Create a bucket on AWS to store the files associated with this project.

{% csrf_token %}