Socket
Socket
Sign inDemoInstall

docker-stream-cleanser

Package Overview
Dependencies
0
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    docker-stream-cleanser

This module cleans the docker headers from the log stream from a container. I never found them very useful, so I wrote this to clean them up either in bulk, or in between a piping. It's not as simple as just removing the first 8 bytes on every message


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

NPM

Build Status

Docker Stream Cleanser

Docker Stream Cleanser is a drop-in module to clean the headers from Docker Logs

  • Cleans the header from finished, stored logs
  • Cleans as it pipes from one stream to another
  • Accounts for any irregularities in streaming
  • Handles any encoding (Ones compatible with Node.js Buffer)

Seeing weird characters at the beginning of each line coming from your Docker container's log stream? This will clear that right up! Docker places a header on each message to help you determine which stream (stdout or stderr) a message should belong to. Thanks Docker, but I just want to read the output! Since there is no setting to turn off this functionality, I wrote this.

More info on Docker's Container Logs

Usage

For clearing from stored logs:

var streamCleanser = require('docker-stream-cleanser');

function(theData) {
    var cleansed = streamCleanser(theData, 'hex');
}

OR

var streamCleanser = require('docker-stream-cleanser');

function(theStream) {
    var cleansed = streamCleanser.async(theStream, 'hex', function(data) {
      console.log('the data!', data);
    });
}

For clearing between streams:

var streamCleanser = require('docker-stream-cleanser');
function(theStream) {
    var cleansed = streamCleanser.cleanStreams(theStream, process.stdout, 'hex', true);
}



// cleanStreams(inputStream, outputStream, encoding, addCarraigeReturn)
// addCarraigeReturn is a flag to replace all \n's in the stream with \r\n

For more info, look at the header comments and the tests

Installation

npm install docker-stream-cleanser --save

License

MIT

Keywords

FAQs

Last updated on 14 Oct 2014

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc