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

Fix #45: Document extra log fields #105

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions docs/django.rst
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,26 @@ In order to include querystrings in the request summary log, set this flag in se
DOCKERFLOW_SUMMARY_LOG_QUERYSTRING = True


A unique request ID is read from the `X-Request-ID` request header, and a UUID4 value is generated if unset.
MozLog App-Specific Fields
~~~~~~~~~~~~~~~~~~~~~~~~~~

Leveraging the `RequestIdFilter` in logging configuration as shown above will add a ``rid`` attribute to all log messages.
The *MozLog* formatter will output ``Fields`` application-specific fields. It can be populated through the ``extra`` parameter:

.. code-block:: python

logger.info(
"Subsystem %s running at %s:%s",
name, host, port,
extra={"phase": "started", "host": host, "port": port}
)


Requests Correlation ID
~~~~~~~~~~~~~~~~~~~~~~~

A unique request ID is read from the ``X-Request-ID`` request header, and a UUID4 value is generated if unset.

Leveraging the ``RequestIdFilter`` in logging configuration as shown above will add a ``rid`` field into the ``Fields`` entry of all log messages.

The header name to obtain the request ID can be customized in settings:

Expand Down
22 changes: 20 additions & 2 deletions docs/fastapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,27 @@ In order to include querystrings in the request summary log, set this flag in th

app.state.DOCKERFLOW_SUMMARY_LOG_QUERYSTRING = True

A unique request ID is read from the `X-Request-ID` request header using the `RequestIdMiddleware` middleware (see :ref:`fastapi-setup`), and a UUID4 value is generated if unset.

Leveraging the `RequestIdFilter` in logging configuration as shown above will add a ``rid`` attribute to all log messages.
MozLog App-Specific Fields
~~~~~~~~~~~~~~~~~~~~~~~~~~

The *MozLog* formatter will output ``Fields`` application-specific fields. It can be populated through the ``extra`` parameter:

.. code-block:: python

logger.info(
"Subsystem %s running at %s:%s",
name, host, port,
extra={"phase": "started", "host": host, "port": port}
)


Requests Correlation ID
~~~~~~~~~~~~~~~~~~~~~~~

A unique request ID is read from the ``X-Request-ID`` request header, and a UUID4 value is generated if unset.

Leveraging the ``RequestIdFilter`` in logging configuration as shown above will add a ``rid`` field into the ``Fields`` entry of all log messages.

The header name to obtain the request ID can be customized in settings:

Expand Down
22 changes: 20 additions & 2 deletions docs/flask.rst
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,27 @@ In order to include querystrings in the request summary log, set this flag in :r

DOCKERFLOW_SUMMARY_LOG_QUERYSTRING = True

A unique request ID is read from the `X-Request-ID` request header, and a UUID4 value is generated if unset.

Leveraging the `RequestIdFilter` in logging configuration as shown above will add a ``rid`` attribute to all log messages.
MozLog App-Specific Fields
~~~~~~~~~~~~~~~~~~~~~~~~~~

The *MozLog* formatter will output ``Fields`` application-specific fields. It can be populated through the ``extra`` parameter:

.. code-block:: python

logger.info(
"Subsystem %s running at %s:%s",
name, host, port,
extra={"phase": "started", "host": host, "port": port}
)


Requests Correlation ID
~~~~~~~~~~~~~~~~~~~~~~~

A unique request ID is read from the ``X-Request-ID`` request header, and a UUID4 value is generated if unset.

Leveraging the ``RequestIdFilter`` in logging configuration as shown above will add a ``rid`` field into the ``Fields`` entry of all log messages.

The header name to obtain the request ID can be customized in settings:

Expand Down
22 changes: 20 additions & 2 deletions docs/sanic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,27 @@ In order to include querystrings in the request summary log, set this flag in :r

DOCKERFLOW_SUMMARY_LOG_QUERYSTRING = True

A unique request ID is read from the `X-Request-ID` request header, and a UUID4 value is generated if unset.

Leveraging the `RequestIdFilter` in logging configuration as shown above will add a ``rid`` attribute to all log messages.
MozLog App-Specific Fields
~~~~~~~~~~~~~~~~~~~~~~~~~~

The *MozLog* formatter will output ``Fields`` application-specific fields. It can be populated through the ``extra`` parameter:

.. code-block:: python

logger.info(
"Subsystem %s running at %s:%s",
name, host, port,
extra={"phase": "started", "host": host, "port": port}
)


Requests Correlation ID
~~~~~~~~~~~~~~~~~~~~~~~

A unique request ID is read from the ``X-Request-ID`` request header, and a UUID4 value is generated if unset.

Leveraging the ``RequestIdFilter`` in logging configuration as shown above will add a ``rid`` field into the ``Fields`` entry of all log messages.

The header name to obtain the request ID can be customized in settings:

Expand Down
Loading