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

Add logging in the admin to see outgoing requests/responses #2762

Closed
6 tasks done
joeribekker opened this issue Feb 23, 2023 · 1 comment · Fixed by maykinmedia/django-log-outgoing-requests#4 or #3074
Closed
6 tasks done
Assignees
Milestone

Comments

@joeribekker
Copy link
Contributor

joeribekker commented Feb 23, 2023

Thema / Theme

Admin

Omschrijving / Description

By far, most discussions arises who sends what to where. Therefore, we should log ALL outgoing requests and make them viewable in the admin. This includes the full URL, headers and body. For now, it's also not needed to link these logs to specific actions in Open Forms. They are mostly used for testing purposes and can be related based on date and time!

To tackle the basic privacy and security concernns: There should be a (Django) permission for viewing logs AND logs should be cleaned up with a regular interval. Other concerns can be tackled in other issues and are not part of this ticket.

I prefer to have a library added for this if it exists, otherwise a library can created for this.
See: https://github.com/maykinmedia/django-log-outgoing-requests

Added value / Toegevoegde waarde

Shorten the time to analyse and fix issues with external systems.

Aanvullende opmerkingen / Additional context

Additional requests I made on the library that didn't make it into the initial version, and thus are tasks for us:

  • Can we make it so this (meaning: save or not save to the database) can be enabled / disabled from the admin (singleton class)?
  • Can we add an autoclean command/task so that entries are deleted after X days (default=7, so I can call clean_request_logs --keep=3)
  • I really prefer a view of the raw request and response (so simply what goes over the line), in addition to the formatted/table view
  • In the list view, I basically want to see 3 things: the request URL, the http response code and the timestamp. The URL can be limited to 100 chars maybe with elipises right after the domain name.
  • List view: Filter on http status code, http method, time hierarchy
  • Logging post body opt in? Just do it

You currently have:

LOG_OUTGOING_REQUESTS_DB_SAVE

Can we change this to have:

LOG_OUTGOING_REQUESTS_ALWAYS_LOG_TO_DB = None  # True, False -both mean ignore admin-, None -use admin setting-

LOG_OUTGOING_REQUESTS_LOG_BODY_TO_DB = True  # only has effect when saving to db

LOG_OUTGOING_REQUESTS_LOG_BODY_TO_STDOUT = False
@joeribekker joeribekker added triage Issue needs to be validated. Remove this label if the issue considered valid. enhancement labels Feb 23, 2023
@joeribekker joeribekker added this to the Release 2.2.0 milestone Feb 23, 2023
@joeribekker joeribekker added prio: medium and removed triage Issue needs to be validated. Remove this label if the issue considered valid. labels Feb 24, 2023
@alextreme
Copy link
Contributor

PyPI: https://pypi.org/project/django-log-outgoing-requests/

Might be good to align Joeri's requests together with @LaurensBurger as the goal of both is the same, but the wishes are different: maykinmedia/django-log-outgoing-requests#2

@joeribekker joeribekker moved this from Todo to In Progress in Development May 1, 2023
pi-sigma added a commit that referenced this issue May 9, 2023
@pi-sigma pi-sigma moved this from In Progress to Implemented in Development May 10, 2023
@pi-sigma pi-sigma moved this from Implemented to In Progress in Development May 12, 2023
@pi-sigma pi-sigma moved this from In Progress to Implemented in Development May 16, 2023
@pi-sigma pi-sigma moved this from Implemented to In Progress in Development May 23, 2023
@pi-sigma pi-sigma moved this from In Progress to Implemented in Development May 31, 2023
@pi-sigma pi-sigma moved this from Implemented to In Progress in Development Jun 2, 2023
@pi-sigma pi-sigma moved this from In Progress to Implemented in Development Jun 5, 2023
@github-project-automation github-project-automation bot moved this from Implemented to Done in Development Jun 8, 2023
@github-project-automation github-project-automation bot moved this from Done to In Progress in Development Jun 8, 2023
@sergei-maertens sergei-maertens moved this from In Progress to Implemented in Development Jun 8, 2023
sergei-maertens added a commit that referenced this issue Jun 9, 2023
When the content is too wide, with float it wraps onto the next line. Using
flexbox ensures this doesn't happen.
sergei-maertens added a commit that referenced this issue Jun 9, 2023
When the content is too wide, with float it wraps onto the next line. Using
flexbox ensures this doesn't happen.
sergei-maertens added a commit that referenced this issue Jun 9, 2023
…ogging

[#2762] update settings: log outgoing requests
@github-project-automation github-project-automation bot moved this from Implemented to Done in Development Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment