Skip to main content

Versatile Data Kit SDK plugin that changes logging output to JSON format.

Project description

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"}```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vdk-logging-json-0.1.415625538.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file vdk-logging-json-0.1.415625538.tar.gz.

File metadata

  • Download URL: vdk-logging-json-0.1.415625538.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for vdk-logging-json-0.1.415625538.tar.gz
Algorithm Hash digest
SHA256 c822d7caef1cfae06d45fc2e6c05734eec2bacc72f8ef13b58ac4e2c1f5f1e02
MD5 1ea594452431f6503ab3c48e5c7c0609
BLAKE2b-256 6683ad7f9313834859282d4762539f1055fc8ff772819e3c4ffbf4932c76997e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page