logging-k8s-metadata
Enriches log records with kubernetes metadata
Getting started
Installation
Install library:
pip install logging-k8s-metadata
Usage
Call setup_logging_k8s_pod_info() method to set up logger factory.
Expose k8s metadata
Logger factory provided by this lib enriches log records with kubernetes
metadata read from /etc/podinfo directory which should be exposed by pod. See
Expose Pod Information to Containers Through Files
for details.
Configure your deployment and add podinfo metadata volume.
Example deployment.yaml with metadata volumes:
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
volumeMounts:
- name: podinfo
mountPath: /etc/podinfo
volumes:
- name: podinfo
downwardAPI:
items:
- path: "name"
fieldRef:
fieldPath: metadata.name
- path: "namespace"
fieldRef:
fieldPath: metadata.namespace
- path: "labels"
fieldRef:
fieldPath: metadata.labels
- path: "annotations"
fieldRef:
fieldPath: metadata.annotations
Development
For standalone library development install requirements:
pip install -r requirements/dev.txt
or install from local repo in developer mode in other project:
pip install -e ../logging-k8s-metadata
Test
pytest
Release
Set version in git tags to release. Always include a patch version to work correctly (ex: 1.2.0, even if patch is 0). After git tag is set, CI will build and publish library on PYPI.
Metadata
Release files for logging-k8s-metadata 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logging_k8s_metadata-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for logging_k8s_metadata-1.0.3-py3-none-any.whl |
Release files / logging_k8s_metadata-1.0.3-py3-none-any.whl
| Download URL | logging_k8s_metadata-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dee622161dde3bba59f8caa48b620c0932032b53da886586564466602c7fb36
|
|
BLAKE2b-256 checksum How to use checksums |
bcb2904c78d3ebdd17a1b46a9d0817c9ecd22a895e615f0b3067e704b11d6297
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Security for logging-k8s-metadata 1.0.3
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.