
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
docker-loghose
Advanced tools
Collect all the logs from all docker containers
As a command line tool:
npm install docker-loghose -g
Embedded usage
npm install docker-loghose --save
var loghose = require('docker-loghose')
var through = require('through2')
var opts = {
json: false, // parse the lines that are coming as JSON
docker: null, // here goes options for Dockerode
events: null, // an instance of docker-allcontainers
newline: false, // Break stream in newlines
// Logs from the container, running docker-loghose are excluded by default.
// It could create endless loops, when the same logs are written to stdout...
// To get all logs set includeCurrentContainer to 'true'
includeCurrentContainer: false, // default value: false
// In a managed environment, container names may be obfuscated.
// If there is a label that provides a better name for logging,
// provide the key here.
nameLabel: 'com.amazonaws.ecs.container-name',
// the following options limit the containers being matched
// so we can avoid catching logs for unwanted containers
matchByName: /hello/, // optional
matchByImage: /matteocollina/, //optional
skipByName: /.*pasteur.*/, //optional
skipByImage: /.*dockerfile.*/, //optional
attachFilter: function (id, dockerInspectInfo) {
// Optional filter function to decide if the log stream should
// be attached to a container or not
// e.g. return /LOGGING_ENABLED=true/i.test(dockerInspectInfo.Config.Env.toString())
return true
}
// Enrich all log events with the labels that are set on the container
// Using a regular expression it's possible to limit which labels are set
// Labels are added into the root of JSON structure, unless 'labelsKey' is defined
addLabels: false // default
labelsMatch: /^ecs-.*/ // defaults to .*
labelsKey: labels // defaults to 'none'
}
var lh = loghose(opts)
lh.pipe(through.obj(function(chunk, enc, cb) {
this.push(JSON.stringify(chunk))
this.push('\n')
// stop listening to specific container logs
if (/top secret logs/.test(chunk.line)) {
lh.detachContainer(chunk.long_id)
// we should not get more logs for the container with chunk.long_id
}
cb()
})).pipe(process.stdout)
docker-loghose [--json] [--help]
[--newline]
[--nameLabel STRING]
[--matchByImage REGEXP] [--matchByName REGEXP]
[--skipByImage REGEXP] [--skipByName REGEXP]
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock matteocollina/docker-loghose
{
v: 0,
id: "3324acd73ad5",
long_id: "3324acd73ad573773b901d93e932be65f2bb55b8e6c03167a24c17ab3f172249"
image: "myimage:latest",
name: "mycontainer-name"
time: 1454928524601,
line: "This is a log line", // this will be an object if opts.jon is true
labels: {
com.amazonaws.ecs.cluster: "my-ecs-cluster"
} // labels placed in 'labels' when "--labelsKey labels"
}
This project was kindly sponsored by nearForm.
MIT
FAQs
Collect all the logs from all docker containers
The npm package docker-loghose receives a total of 146 weekly downloads. As such, docker-loghose popularity was classified as not popular.
We found that docker-loghose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

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.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.