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

flaschenpost

Package Overview
Dependencies
Maintainers
4
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flaschenpost - npm Package Compare versions

Comparing version 0.13.1 to 0.13.2

bin/flaschenpost-normalize.js

33

lib/flaschenpost.js

@@ -7,3 +7,2 @@ 'use strict';

processenv = require('processenv'),
split2 = require('split2'),
stackTrace = require('stack-trace');

@@ -17,3 +16,2 @@

Middleware = require('./Middleware'),
Paragraph = require('./letter/Paragraph'),
readPackageJson = require('./readPackageJson');

@@ -97,33 +95,2 @@

flaschenpost.uncork = function (inputStream, outputStream) {
const formatter = new FormatterHumanReadable();
formatter.pipe(outputStream);
inputStream.pipe(split2()).on('data', data => {
let node,
position = 0;
do {
try {
node = JSON.parse(data.substr(position));
} catch (ex) {
position = data.indexOf('{', position + 1);
if (position === -1) {
node = new Paragraph(-1, {
host: 'n/a',
application: { name: 'n/a', version: 'n/a' },
module: { name: 'n/a', version: 'n/a' },
level: 'info',
message: data
});
break;
}
}
} while (typeof node !== 'object');
formatter.write(node);
});
};
flaschenpost.Middleware = Middleware;

@@ -130,0 +97,0 @@

2

lib/formatters/HumanReadable.js

@@ -42,3 +42,3 @@ 'use strict';

result += colorize(`${chunk.message} (${chunk.level})`, 'bold');
result += colorize(`${chunk.message} (${chunk.level})`, chunk.level, 'bold');
result += '\n';

@@ -45,0 +45,0 @@ result += colorize(origin, 'white');

{
"name": "flaschenpost",
"version": "0.13.1",
"version": "0.13.2",
"description": "flaschenpost is a logger for cloud-based applications.",

@@ -27,10 +27,15 @@ "contributors": [

],
"bin": "bin/flaschenpost.js",
"bin": {
"flaschenpost-normalize": "bin/flaschenpost-normalize.js",
"flaschenpost-to-elastic": "bin/flaschenpost-to-elastic.js",
"flaschenpost-uncork": "bin/flaschenpost-uncork.js"
},
"main": "lib/flaschenpost.js",
"dependencies": {
"app-root-path": "1.3.0",
"app-root-path": "2.0.1",
"chalk": "1.1.3",
"elasticsearch": "11.0.1",
"find-root": "1.0.0",
"lodash": "4.14.2",
"moment": "2.14.1",
"lodash": "4.15.0",
"moment": "2.15.0",
"processenv": "0.1.0",

@@ -40,3 +45,3 @@ "split2": "2.1.0",

"stringify-object": "2.4.0",
"update-notifier": "1.0.2",
"uuidv4": "0.3.1",
"varname": "2.0.2"

@@ -49,5 +54,5 @@ },

"nodeenv": "0.2.1",
"roboter": "0.12.3",
"roboter-server": "0.12.3",
"sinon": "1.17.5",
"roboter": "0.13.0",
"roboter-server": "0.13.0",
"sinon": "1.17.6",
"supertest": "2.0.0"

@@ -54,0 +59,0 @@ },

@@ -11,4 +11,2 @@ # flaschenpost

### As Node.js module
```bash

@@ -18,8 +16,2 @@ $ npm install flaschenpost

### As CLI
```bash
$ npm install -g flaschenpost
```
## Quick start

@@ -153,10 +145,40 @@

## Processing logs
To process logs, first you need to install the flaschenpost CLI globally.
```bash
$ npm install -g flaschenpost
```
### Uncorking a flaschenpost
From time to time you may want to inspect log files that contain messages created by flaschenpost. For that, run the CLI tool and provide the log file via stdin.
From time to time you may want to inspect log output that was written using the JSON formatter. To turn that into human readable output again, run `flaschenpost-uncork` and provide the messages using the standard input stream.
```bash
$ flaschenpost < foo.log
$ cat sample.log | flaschenpost-uncork
```
### Normalizing messages
However, this won't work when your log output does not only contain messages written by flaschenpost, but also arbitrary text. In this case, run `flaschenpost-normalize` and provide the messages using the standard input stream.
```bash
$ node sample.js | flaschenpost-normalize
```
### Sending messages to Elasticsearch
If you want to process your log output with Elasticsearch and Kibana, you do not need to use Logstash or Filebeat. Instead run `flaschenpost-to-elastic` and provide the address of the Elasticsearch server using the `ELASTIC_URL` environment variable.
```bash
$ node sample.js | ELASTIC_URL=localhost:9200 flaschenpost-to-elastic
```
Please note that it may be needed to normalize the messages before sending them to Elasticsearch. You probably also want to redirect the application's standard error stream to its standard output stream.
```bash
$ node sample.js 2>&1 | flaschenpost-normalize | ELASTIC_URL=localhost:9200 flaschenpost-to-elastic
```
## Running the build

@@ -167,3 +189,3 @@

```bash
$ bot build-server
$ bot
```

@@ -170,0 +192,0 @@

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