A python threadded logging handler and service extension for Azure Log Workspace OMS REST API.
Likely abandoned. No release or commit for years (last release over 5 years ago).
pip install logging-azure-restPython Logging Azure Workspace OMS Extension
This package provides an asynchronous solution for uploading application logs to an Azure Log Workspace using their
provided REST API, all supplied as a handler and service extension for python builtin logging module.
The service works by instantiating an always-alive (non-daemonized) thread connected to a log request pool in which
logs will be queued, then periodically running through the pool in order to send the requests in bulk
using the requests package. This is all to intend logging safely without interrupting or slowing down the main
process execution as transparently as possible.
Installation
For installing via the distributed package via PyPi:
$ pip install logging-azure-rest
Or if you which to install from the source, you can checkout the git repository and install using setuptools:
$ python setup.py install
Usage
Package Configuration
The following environment variables are read to configure the extension and are required:
AZURE_LOG_CUSTOMER_ID: Customer ID for the Azure Log WorkspaceAZURE_LOG_SHARED_KEY: Customer shared key for the Azure Log WorkspaceAZURE_LOG_DEFAULT_NAME: The default "log type" name to indicate where the logs are stored. This will be suffixed with "_CL" within the Azure Log Workspace.
The following environment variables are read to tweak some parameters of the extension, they all have default values and therefore are optional:
AZURE_LOG_SEND_FREQUENCY: Default: 5 How many seconds the service thread should wait before sending pooled logs.
Logging Configuration
As you would any other handler, you only require to define a handler using the
logging_azure.handler.AzureLogServiceHandler class:
[...]
"handlers": {
"console": {"level": logging.DEBUG, "class": "logging.StreamHandler", "formatter": "colorize"},
"azure_log_oms": {
"level": logging.INFO, "class": "logging_azure.handler.AzureLogServiceHandler", "formatter": "azure"
},
"default": {"level": logging.INFO, "class": "logging.StreamHandler", "formatter": "default"},
},
[...]
