Merge "Extended documentation for using custom loggers"
This commit is contained in:
commit
0ca2d007e2
@ -939,3 +939,42 @@ ago, and you've already cleaned up any orphans with `swift-orphans`,
|
||||
you can run `swift-oldies -a 48` to find any Swift processes still
|
||||
around that were started more than 2 days ago and then investigate
|
||||
them accordingly.
|
||||
|
||||
|
||||
|
||||
-------------------
|
||||
Custom Log Handlers
|
||||
-------------------
|
||||
|
||||
Swift supports setting up custom log handlers for services by specifying a
|
||||
comma-separated list of functions to invoke when logging is setup. It does so
|
||||
via the `log_custom_handlers` configuration option. Logger hooks invoked are
|
||||
passed the same arguments as Swift's get_logger function (as well as the
|
||||
getLogger and LogAdapter object):
|
||||
|
||||
============== ===============================================
|
||||
Name Description
|
||||
-------------- -----------------------------------------------
|
||||
conf Configuration dict to read settings from
|
||||
name Name of the logger received
|
||||
log_to_console (optional) Write log messages to console on stderr
|
||||
log_route Route for the logging received
|
||||
fmt Override log format received
|
||||
logger The logging.getLogger object
|
||||
adapted_logger The LogAdapter object
|
||||
============== ===============================================
|
||||
|
||||
A basic example that sets up a custom logger might look like the
|
||||
following:
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def my_logger(conf, name, log_to_console, log_route, fmt, logger,
|
||||
adapted_logger):
|
||||
my_conf_opt = conf.get('some_custom_setting')
|
||||
my_handler = third_party_logstore_handler(my_conf_opt)
|
||||
logger.addHandler(my_handler)
|
||||
|
||||
See :ref:`custom-logger-hooks-label` for sample use cases.
|
||||
|
||||
|
@ -59,6 +59,13 @@ Alternative API
|
||||
* `Swift3 <https://github.com/fujita/swift3>`_ - Amazon S3 API emulation.
|
||||
|
||||
|
||||
.. _custom-logger-hooks-label:
|
||||
|
||||
Custom Logger Hooks
|
||||
-------------------
|
||||
|
||||
* `swift-sentry <https://github.com/pandemicsyn/swift-sentry>`_ - Sentry exception reporting for Swift
|
||||
|
||||
Other
|
||||
-----
|
||||
|
||||
|
@ -220,9 +220,9 @@ The following configuration options are available:
|
||||
|
||||
[DEFAULT]
|
||||
|
||||
================== ========== =============================================
|
||||
=================== ========== =============================================
|
||||
Option Default Description
|
||||
------------------ ---------- ---------------------------------------------
|
||||
------------------- ---------- ---------------------------------------------
|
||||
swift_dir /etc/swift Swift configuration directory
|
||||
devices /srv/node Parent directory of where devices are mounted
|
||||
mount_check true Whether or not check if the devices are
|
||||
@ -233,7 +233,9 @@ bind_port 6000 Port for server to bind to
|
||||
workers 1 Number of workers to fork
|
||||
disable_fallocate false Disable "fast fail" fallocate checks if the
|
||||
underlying filesystem does not support it.
|
||||
================== ========== =============================================
|
||||
log_custom_handlers None Comma-separated list of functions to call
|
||||
to setup custom log handlers.
|
||||
=================== ========== =============================================
|
||||
|
||||
[object-server]
|
||||
|
||||
@ -326,9 +328,9 @@ The following configuration options are available:
|
||||
|
||||
[DEFAULT]
|
||||
|
||||
================== ========== ============================================
|
||||
=================== ========== ============================================
|
||||
Option Default Description
|
||||
------------------ ---------- --------------------------------------------
|
||||
------------------- ---------- --------------------------------------------
|
||||
swift_dir /etc/swift Swift configuration directory
|
||||
devices /srv/node Parent directory of where devices are mounted
|
||||
mount_check true Whether or not check if the devices are
|
||||
@ -340,7 +342,9 @@ workers 1 Number of workers to fork
|
||||
user swift User to run as
|
||||
disable_fallocate false Disable "fast fail" fallocate checks if the
|
||||
underlying filesystem does not support it.
|
||||
================== ========== ============================================
|
||||
log_custom_handlers None Comma-separated list of functions to call
|
||||
to setup custom log handlers.
|
||||
=================== ========== ============================================
|
||||
|
||||
[container-server]
|
||||
|
||||
@ -422,9 +426,9 @@ The following configuration options are available:
|
||||
|
||||
[DEFAULT]
|
||||
|
||||
================== ========== =============================================
|
||||
=================== ========== =============================================
|
||||
Option Default Description
|
||||
------------------ ---------- ---------------------------------------------
|
||||
------------------- ---------- ---------------------------------------------
|
||||
swift_dir /etc/swift Swift configuration directory
|
||||
devices /srv/node Parent directory or where devices are mounted
|
||||
mount_check true Whether or not check if the devices are
|
||||
@ -440,7 +444,9 @@ db_preallocation off If you don't mind the extra disk space usage in
|
||||
fragmentation.
|
||||
disable_fallocate false Disable "fast fail" fallocate checks if the
|
||||
underlying filesystem does not support it.
|
||||
================== ========== =============================================
|
||||
log_custom_handlers None Comma-separated list of functions to call
|
||||
to setup custom log handlers.
|
||||
=================== ========== =============================================
|
||||
|
||||
[account-server]
|
||||
|
||||
@ -536,6 +542,9 @@ cors_allow_origin This is a list of hosts that
|
||||
Access-Control-Allow-Origin
|
||||
header in addition to what
|
||||
the container has set.
|
||||
log_custom_handlers None Comma separated list of functions
|
||||
to call to setup custom log
|
||||
handlers.
|
||||
============================ =============== =============================
|
||||
|
||||
[proxy-server]
|
||||
@ -808,3 +817,5 @@ Swift is set up to log directly to syslog. Every service can be configured
|
||||
with the `log_facility` option to set the syslog log facility destination.
|
||||
We recommended using syslog-ng to route the logs to specific log
|
||||
files locally on the server and also to remote log collecting servers.
|
||||
Additionally, custom log handlers can be used via the custom_log_handlers
|
||||
setting.
|
||||
|
Loading…
Reference in New Issue
Block a user