flaschenpost
Advanced tools
Comparing version 0.13.1 to 0.13.2
@@ -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 @@ |
@@ -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 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
35
199
136689
12
1594
3
1
+ Addedelasticsearch@11.0.1
+ Addeduuidv4@0.3.1
+ Addedapp-root-path@2.0.1(transitive)
+ Addedasap@2.0.6(transitive)
+ Addedelasticsearch@11.0.1(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedlodash@3.10.14.15.0(transitive)
+ Addedlodash-compat@3.10.2(transitive)
+ Addedmoment@2.15.0(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addeduuidv4@0.3.1(transitive)
- Removedupdate-notifier@1.0.2
- Removedansi-align@1.1.0(transitive)
- Removedapp-root-path@1.3.0(transitive)
- Removedboxen@0.6.0(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedcapture-stack-trace@1.0.2(transitive)
- Removedcli-boxes@1.0.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedconfigstore@2.1.0(transitive)
- Removedcreate-error-class@3.0.2(transitive)
- Removeddeep-extend@0.6.0(transitive)
- Removeddot-prop@3.0.0(transitive)
- Removedduplexer2@0.1.4(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedfilled-array@1.1.0(transitive)
- Removedgot@5.7.1(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedimurmurhash@0.1.4(transitive)
- Removedini@1.3.8(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedis-npm@1.0.0(transitive)
- Removedis-obj@1.0.1(transitive)
- Removedis-redirect@1.0.0(transitive)
- Removedis-retry-allowed@1.2.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedlatest-version@2.0.0(transitive)
- Removedlazy-req@1.1.0(transitive)
- Removedlodash@4.14.2(transitive)
- Removedlowercase-keys@1.0.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmoment@2.14.1(transitive)
- Removednode-status-codes@1.0.0(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedpackage-json@2.4.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedprepend-http@1.0.4(transitive)
- Removedrc@1.2.8(transitive)
- Removedread-all-stream@3.1.0(transitive)
- Removedregistry-auth-token@3.4.0(transitive)
- Removedregistry-url@3.1.0(transitive)
- Removedrepeating@2.0.1(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsemver-diff@2.1.0(transitive)
- Removedslide@1.1.6(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedtimed-out@3.1.3(transitive)
- Removedunzip-response@1.0.2(transitive)
- Removedupdate-notifier@1.0.2(transitive)
- Removedurl-parse-lax@1.0.0(transitive)
- Removeduuid@2.0.3(transitive)
- Removedwidest-line@1.0.0(transitive)
- Removedwrite-file-atomic@1.3.4(transitive)
- Removedxdg-basedir@2.0.0(transitive)
Updatedapp-root-path@2.0.1
Updatedlodash@4.15.0
Updatedmoment@2.15.0