Skip to main content

Introduction

This logs_ingestion package provides several methods for logging data into Azure Monitor using the Logs Ingestion API.

The following attributes are part of the logging with the coding attribute names between brackets:

  • TimeGenerated (time_generated): the datetime the logging entry was created (required)
  • Message (message): the message of the log entry (optional)
  • Duration (duration): the duration of the function in case the decorator is used (optional)
  • Status (status): the status of the system (optional)
  • RunId (run_id): the run ID of the flow that is being processed (required)
  • Tag (tag): the tag for grouping log entries (required)

The attribute TimeGenerated is automatically set for you. The RunId and Tag are part of the configuration of the logger you need to create and only need to be set once per logger.

Usage

You'll need a logger to perform the actual logging:

logger: Logger = get_logger(__name__, run_id="42", tag="logger1")

With the logger instantiation you'll also set the RunId and Tag to be used in all logging entries as generated through this logger.

The first method for logging information is by using a decorator in your Python code:

@time_and_log(logger=logger, message="bla", status="timed")
def my_function():
    pass

Whenever the my_function() is called a log entry is created with when the function end that automatically includes the duration of the function call. This is a convenient way for monitoring the performance of functions and the possible drift in processing times. With the message and status arguments you can add additional details to the message logged.

The second method is by calling the usual logging lines, for example:

from logs_ingestion.logs_record import LogsRecord
logger.warning(message='testing azure logging', record=LogsRecord(
               status="OK",
               duration=1.23))

The arguments are:

  • message, speaks for itself
  • record, the record(s) to be logged

The record argument must be either a LogsRecord or a list of LogsRecords. By using a list, you can simply log a whole batch of log records in one command. The rund_id and tag from the logger are pushed down to the individual log messages.

Metadata

Release files for logs-ingestion 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logs-ingestion 0.2.5
File Size Uploaded Provenance Actions
logs_ingestion-0.2.5.tar.gz 4.2 kB Without provenance Details for logs_ingestion-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for logs-ingestion 0.2.5
File Interpreter ABI Platform Actions
logs_ingestion-0.2.5-py3-none-any.whl Python 3 none any Details for logs_ingestion-0.2.5-py3-none-any.whl

Total release size: 9.7 kB

Release files / logs_ingestion-0.2.5.tar.gz

Download URL logs_ingestion-0.2.5.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
30d3a8f436fec5204655b260d8d8f91ff8b027e8fd227e0653e990948962069e
BLAKE2b-256 checksum
How to use checksums
210f07f9678dabaa7869acdc257792b3b3598e88f40be14e102761e3db381a07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0

Release files / logs_ingestion-0.2.5-py3-none-any.whl

Download URL logs_ingestion-0.2.5-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3054f757484d18052b2384dee299be31ce958abb046d4b28e5be540f45f97da9
BLAKE2b-256 checksum
How to use checksums
4b2c8764b1c2f3b5611586f28008631ee89f6fe8234e2c4d893aead1128978b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0

Security for logs-ingestion 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page