Configuration Constants and Environment Variables - hacktlib/py-async-http-logging GitHub Wiki

Constants

As already explained in our documentation, Async HTTP Logging works based on the Python LogStash library.

To set custom constant values, please override the Python LogStash ones:

from http_logging import AsyncHttpHandler
from logstash_async import constants

constants.QUEUED_EVENTS_FLUSH_INTERVAL = 5.0

Make sure to override the constants after you import the http_logging Classes (e.g. AsyncHttpHandler), as demonstrated above. Otherwise, http_logging defaults might override the values you set.

For a reference of all constant values available, please refer to Options for the asynchronous processing and formatting ⧉ in the Python LogStash documentation.

Environment Variables

Optionally, Async HTTP Logging allows you to configure some of these parameters as environment variables.

Here is a complete list:

  • ASYNC_LOG_HTTP_PORT: defaults to 80 (converted to int)
  • ASYNC_LOG_HTTPS_PORT: defaults to 443 (converted to int)
  • ASYNC_LOG_DATABASE_PATH: defaults to 'logging-cache.db'
  • ASYNC_LOG_TIMEOUT: defaults to 5.0 (converted to float)
  • ASYNC_LOG_ENCODING: defaults to sys.getfilesystemencoding()
  • ASYNC_LOG_QUEUE_CHECK_INTERVAL: defaults to 1.0 (converted to float)
  • QUEUED_EVENTS_FLUSH_INTERVAL: defaults to 5.0 (converted to float)
  • ASYNC_LOG_QUEUED_EVENTS_FLUSH_COUNT: defaults to 10 (converted to int)
  • ASYNC_LOG_QUEUED_EVENTS_BATCH_SIZE: defaults to 10 (converted to int)
  • ASYNC_LOG_DATABASE_TIMEOUT: defaults to 2.5 (converted to float)
⚠️ **GitHub.com Fallback** ⚠️