API Log

api_log
REPOSITORY
REPOSITORYOCA/rest-framework
GIT
GIThttps://github.com/OCA/rest-framework.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/rest-framework/tree/18.0/api_log
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Akretion
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Akretion
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, Florian Mounier
WEBSITE
WEBSITEhttps://github.com/OCA/rest-framework
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:30:05
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - web
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
This module allows to store request and response logs for any API.

When a response is logged, the header `API_LOG_ENTRY_ID` is injected in the response header.
This header stores the identifier of the log record produced from the response.

Code Analysis

Views touched (3)
XML IDNameModelTypeStatus
api_log_view_form api.log.form api.log form New
api_log_view_search api.log.search api.log search New
api_log_view_tree api.log.list api.log list New
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (2)

New fields (28)
  • collection_id Integer
    compute='_compute_collection' index=True store=True
  • collection_model Char
    compute='_compute_collection' index=True store=True
  • collection_ref Reference
    selection='_selection_collection_ref'
  • name Char
    compute='_compute_name' store=True
  • referrer Char
    compute='_compute_request_headers_derived' store=True
  • request_b64 Binary
    compute='_compute_request_b64' string='Request Content'
  • request_body Binary
    attachment=False
  • request_content_length Integer
    compute='_compute_request_headers_derived' store=True
  • request_content_type Char
    compute='_compute_request_headers_derived' store=True
  • request_date Datetime
  • request_headers Json
  • request_headers_preview Text
    compute='_compute_headers_preview'
  • request_method Char
  • request_preview Text
    compute='_compute_request_preview'
  • request_time Float
  • request_url Char
  • response_b64 Binary
    compute='_compute_response_b64' string='Response Content'
  • response_body Binary
    attachment=False
  • response_content_length Integer
    compute='_compute_response_headers_derived' store=True
  • response_content_type Char
    compute='_compute_response_headers_derived' store=True
  • response_date Datetime
  • response_headers Json
  • response_headers_preview Text
    compute='_compute_headers_preview'
  • response_preview Text
    compute='_compute_response_preview'
  • response_status_code Integer
  • response_time Float
  • stack_trace Text
  • time Float
    compute='_compute_time' store=True
Public methods (3)
  • log_exception(self, exception)
  • log_request(self, request, override_log_values=None)
    @api.model
  • log_response(self, response)

New fields (2)
  • log_ids One2many → api.log
    comodel_name='api.log' compute='_compute_log_ids' string='Logs'
  • log_requests Boolean
    help='Log requests in database.'
Public methods (1)
  • action_logs(self)
REPOSITORY
REPOSITORYOCA/rest-framework
GIT
GIThttps://github.com/OCA/rest-framework.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/rest-framework/tree/17.0/api_log
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Akretion
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Akretion
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, Simone Rubino, oca-ci
WEBSITE
WEBSITEhttps://github.com/OCA/rest-framework
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-07 07:41:28
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - web
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
This module allows to store request and response logs for any API.

When a response is logged, the header `API_LOG_ENTRY_ID` is injected in the response header.
This header stores the identifier of the log record produced from the response.

Code Analysis

Views touched (3)
XML IDNameModelTypeStatus
api_log_view_form api.log.form api.log form New
api_log_view_search api.log.search api.log search New
api_log_view_tree api.log.tree api.log tree New
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (2)

New fields (28)
  • collection_id Integer
    compute='_compute_collection' index=True store=True
  • collection_model Char
    compute='_compute_collection' index=True store=True
  • collection_ref Reference
    selection='_selection_collection_ref'
  • name Char
    compute='_compute_name' store=True
  • referrer Char
    compute='_compute_request_headers_derived' store=True
  • request_b64 Binary
    compute='_compute_request_b64' string='Request Content'
  • request_body Binary
    attachment=False
  • request_content_length Integer
    compute='_compute_request_headers_derived' store=True
  • request_content_type Char
    compute='_compute_request_headers_derived' store=True
  • request_date Datetime
  • request_headers Json
  • request_headers_preview Text
    compute='_compute_headers_preview'
  • request_method Char
  • request_preview Text
    compute='_compute_request_preview'
  • request_time Float
  • request_url Char
  • response_b64 Binary
    compute='_compute_response_b64' string='Response Content'
  • response_body Binary
    attachment=False
  • response_content_length Integer
    compute='_compute_response_headers_derived' store=True
  • response_content_type Char
    compute='_compute_response_headers_derived' store=True
  • response_date Datetime
  • response_headers Json
  • response_headers_preview Text
    compute='_compute_headers_preview'
  • response_preview Text
    compute='_compute_response_preview'
  • response_status_code Integer
  • response_time Float
  • stack_trace Text
  • time Float
    compute='_compute_time' store=True
Public methods (3)
  • log_exception(self, exception)
  • log_request(self, request, override_log_values=None)
    @api.model
  • log_response(self, response)

New fields (2)
  • log_ids One2many → api.log
    comodel_name='api.log' compute='_compute_log_ids' string='Logs'
  • log_requests Boolean
    help='Log requests in database.'
Public methods (1)
  • action_logs(self)
REPOSITORY
REPOSITORYOCA/rest-framework
GIT
GIThttps://github.com/OCA/rest-framework.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/rest-framework/tree/16.0/api_log
VERSION
VERSION
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Akretion
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Akretion
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, Simone Rubino, oca-ci, Alessandro Pecchini
WEBSITE
WEBSITEhttps://github.com/OCA/rest-framework
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:11:49
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - web
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
This module allows to store request and response logs for any API.

When a response is logged, the header `API_LOG_ENTRY_ID` is injected in the response header.
This header stores the identifier of the log record produced from the response.

A scheduled action "API Log: Delete old logs" is available to automatically
delete old API log records. It is **disabled by default**.

To enable it, go to Settings > Technical > Automation > Scheduled Actions
and activate "API Log: Delete old logs".

The retention period (in days) is configurable through the system parameter
`api_log.retention_days`, which defaults to 180 days. Logs with a
`request_date` older than this threshold are deleted when the cron runs.

Code Analysis

Views touched (3)
XML IDNameModelTypeStatus
api_log_view_form api.log.form api.log form New
api_log_view_search api.log.search api.log search New
api_log_view_tree api.log.tree api.log tree New
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (2)

New fields (28)
  • collection_id Integer
    compute='_compute_collection' index=True store=True
  • collection_model Char
    compute='_compute_collection' index=True store=True
  • collection_ref Reference
    selection='_selection_collection_ref'
  • name Char
    compute='_compute_name' store=True
  • referrer Char
    compute='_compute_request_headers_derived' store=True
  • request_b64 Binary
    compute='_compute_request_b64' string='Request Content'
  • request_body Binary
    attachment=False
  • request_content_length Integer
    compute='_compute_request_headers_derived' store=True
  • request_content_type Char
    compute='_compute_request_headers_derived' store=True
  • request_date Datetime
    index=True
  • request_headers Json
  • request_headers_preview Text
    compute='_compute_headers_preview'
  • request_method Char
  • request_preview Text
    compute='_compute_request_preview'
  • request_time Float
  • request_url Char
  • response_b64 Binary
    compute='_compute_response_b64' string='Response Content'
  • response_body Binary
    attachment=False
  • response_content_length Integer
    compute='_compute_response_headers_derived' store=True
  • response_content_type Char
    compute='_compute_response_headers_derived' store=True
  • response_date Datetime
  • response_headers Json
  • response_headers_preview Text
    compute='_compute_headers_preview'
  • response_preview Text
    compute='_compute_response_preview'
  • response_status_code Integer
    index=True
  • response_time Float
  • stack_trace Text
  • time Float
    compute='_compute_time' store=True
Public methods (4)
  • cron_delete_logs(self)
    @api.model
  • log_exception(self, exception)
  • log_request(self, request, override_log_values=None)
    @api.model
  • log_response(self, response)

New fields (2)
  • log_ids One2many → api.log
    comodel_name='api.log' compute='_compute_log_ids' string='Logs'
  • log_requests Boolean
    help='Log requests in database.'
Public methods (1)
  • action_logs(self)