Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PXP-7805 Fetch audit logs from an AWS SQS #2

Merged
merged 9 commits into from
Jun 10, 2021
Merged

Conversation

paulineribeyre
Copy link
Collaborator

@paulineribeyre paulineribeyre commented May 26, 2021

Jira Ticket: PXP-7805

goes with uc-cdis/fence#923 and uc-cdis/cloud-automation#1603

New Features

  • The audit service can be configured to fetch audit logs from an AWS SQS

Improvements

  • Return an error if an invalid timestamp is provided to the log creation endpoint
  • Presigned URL logs can now have an empty "resource_paths" field

Dependency updates

  • Add dependency to boto3 version ^1.14

Deployment changes

  • If a previous version of the audit service has already been deployed, run kubectl delete secret audit-g3auto and gen3 kube-setup-audit-service to configure the audit SQS and update the configuration file. REQUIRES Fence 5.1.0 or more recent. OR to disable pulling from a queue, update the configuration file manually to disable "PULL_FROM_QUEUE"

@github-actions
Copy link

The style in this PR agrees with black. ✔️

This formatting comment was generated automatically by a script in uc-cdis/wool.

Comment on lines 24 to 27
sqs_url:
region:
aws_access_key_id:
aws_secret_access_key:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is just my opinion. Should we put these under the type: aws_sqs block just to have configs organized under different types of queues?

try:
response = sqs.receive_message(
QueueUrl=config["QUEUE_CONFIG"]["sqs_url"],
MaxNumberOfMessages=10, # 10 is the max
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you can only do 10 the limit from the sqs side? If not should make this configurable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a limit on the AWS side (doc)

@@ -70,6 +71,15 @@ def app_init() -> FastAPI:
db.init_app(app)
load_modules(app)

@app.on_event("startup")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this keeps on running and pulls in from the queue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, pull_from_queue_loop is called when the app starts and keeps pulling from the queue in an infinite loop

BinamB
BinamB previously approved these changes Jun 7, 2021
@BinamB BinamB self-requested a review June 7, 2021 20:21
@BinamB BinamB dismissed their stale review June 8, 2021 15:21

woops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants