Skip to content

Filter Kubernetes secrets from application logs

Notifications You must be signed in to change notification settings

tadeugr/filter-k8s-logs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filter Kubernetes logs for secrets and other sensitive information

Here's the approach in a nutshell:

  • forward the stdout of the main application container to a file
  • run a sidecar container and share the file where the main application container writes the logs
  • run a filtering process in the sidecar that continuously reads the main application log file and writes the filtered logs to the sidecar stdout
  • collect the sidecar stdout as the application logs

This approach allows us to filter the logs for a single application in the cluster, and assumes the main application can be modified to output its stdout to a file.

Using and deploying the sample

In the sample directory there is a simple NodeJS application and the Kubernetes manifests to deploy the main application and the filter.

Building from source and running locally

Prerequisites:

To build from source:

  • glide install
  • make build or go build to build the binary for your OS
  • if running and testing locally, you must specify a local LOGS_FILE, the location of your Kubernetes config file through KUBECONFIG and the desired namespace to filter secrets from through KUBECONFIG.

About

Filter Kubernetes secrets from application logs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 72.2%
  • Makefile 22.5%
  • Dockerfile 5.3%