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.

The new format has the following fields, separated by tabs:

  • timestamp: a timestamp of when the log is made;
  • created: the same timestamp in the unix epoch format;
  • 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.

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.

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-08-04T12:51:11.532Z","created":"1628070671","jobname":"example-job","level":"DEBUG","modulename":"taurus.vdk.trino_connection","filename":"managed_connection_base.py","lineno":"69","funcname":"connect","attemptid":"1628070671-452613-739749","message":"Established <trino.dbapi.Connection object at 0x10b9b1d30>"}
{"@timestamp":"2021-08-04T12:51:11.532Z","created:1628070671","jobname":"example-job","level":"DEBUG","modulename":"taurus.vdk.trino_connection","filename":"managed_cursor.py","lineno":"29","funcname":"execute","attemptid":"1628070671-452613-739749","message":"Executing query: select 1"}

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.353684692.tar.gz (2.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: vdk-logging-json-0.1.353684692.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.11

File hashes

Hashes for vdk-logging-json-0.1.353684692.tar.gz
Algorithm Hash digest
SHA256 f1e59cc7016116ed48cad63bb902f38c37e36a4ca8cd82371e93c79ab7a3727b
MD5 c38a4277984804f3800abda7d4d94a95
BLAKE2b-256 e75136d252ef39d919ada58ba3b1111430f22c7c54feae579e891ea293ad0c55

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