New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

logging-k8s-metadata

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logging-k8s-metadata

logging-k8s-metadata

  • 1.0.3
  • PyPI
  • Socket score

Maintainers
1

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc