Skip to main content

This is a POC level implementation of a plugin which changes the logging format of vdk-core to JSON for the purposes of structured data visualization in a log aggregator.

The new format has the following fields:

  • @timestamp: a timestamp of when the log is made;
  • jobname: the name of the data job;
  • level: the logging level - one of INFO, WARNING, DEBUG, ERROR;
  • modulename: the name of the module, inside of which the logging call is made;
  • filename: the name of the file containing the logging call being made;
  • lineno: the number of the line of code, at which the logging call is made;
  • funcname: the name of the function, inside which the loggin call is made;
  • attemptid: string identifying this particular execution of the data job;
  • message: any additional logged information.

If the log record contains an error, it will also contain the following fields:

  • error.message: the message of the exception;
  • error.stack_trace: a stack trace of the exception;
  • error.type: the type of exception.

The label names follow the labelling recommendations found at http://ltsv.org/. The reason we chose the LTSV naming standard is due to the fact that this plugin was based on a previous LTSV-formatting plugin, as well as the fact that there is no single JSON naming standard.

Additionally, double quote characters within the message are escaped.

Usage

Switching vdk logging can be done by simply installing the plugin:

pip install vdk-logging-json

And all logs will be automatically formatted to JSON. They will appear like this:

{"@timestamp": "2021-10-14T11:37:44.703Z", "message": "Checking if job should be skipped:", "level": "INFO", "lineno": 102, "filename": "execution_skip.py", "modulename": "vdk.plugin.control_cli_plugin.execution_skip", "funcname": "_skip_job_if_necessary", "jobname": "gg-job4", "attemptid": "1634211464-1ee897-a3f0eb"}```

Metadata

Release files for vdk-logging-json 0.1.664990419

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

Source distribution (sdist)

Source distribution for vdk-logging-json 0.1.664990419
File Size Uploaded
vdk-logging-json-0.1.664990419.tar.gz 2.9 kB Details

Release files / vdk-logging-json-0.1.664990419.tar.gz

Download URL vdk-logging-json-0.1.664990419.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f8a1d7230a3cc6f3034f66dd658a8f73b3a0c3d4db2a264fe93f60bb096e43cc
BLAKE2b-256 checksum
How to use checksums
81a288474de4950c0f6995ee79bb53298565a26d5a700db97e67f21cb47c07f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13
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