Comments (5)
+1
from node-bunyan.
Sorry to have ignored this ticket for so long. Busy yada yada.
FWIW, my json tool is pretty good for this. For example:
$ node foo.js
{"name":"myapp","hostname":"banana.local","pid":10837,"level":30,"msg":"start","time":"2013-01-10T04:27:35.875Z","v":0}
{"name":"myapp","hostname":"banana.local","pid":10837,"widget_type":"wuzzle","level":30,"msg":"creating a wuzzle","time":"2013-01-10T04:27:35.876Z","v":0}
{"name":"myapp","hostname":"banana.local","pid":10837,"widget_type":"wuzzle","level":40,"msg":"This wuzzle is woosey.","time":"2013-01-10T04:27:35.876Z","v":0}
{"name":"myapp","hostname":"banana.local","pid":10837,"level":30,"msg":"done","time":"2013-01-10T04:27:35.877Z","v":0}
$ node foo.js | json -gj
[
{
"name": "myapp",
"hostname": "banana.local",
"pid": 10848,
"level": 30,
"msg": "start",
"time": "2013-01-10T04:28:33.193Z",
"v": 0
},
{
"name": "myapp",
"hostname": "banana.local",
"pid": 10848,
"widget_type": "wuzzle",
"level": 30,
"msg": "creating a wuzzle",
"time": "2013-01-10T04:28:33.194Z",
"v": 0
},
{
"name": "myapp",
"hostname": "banana.local",
"pid": 10848,
"widget_type": "wuzzle",
"level": 40,
"msg": "This wuzzle is woosey.",
"time": "2013-01-10T04:28:33.195Z",
"v": 0
},
{
"name": "myapp",
"hostname": "banana.local",
"pid": 10848,
"level": 30,
"msg": "done",
"time": "2013-01-10T04:28:33.195Z",
"v": 0
}
]
If the bunyan-using emits non-Bunyan log lines, then you'll need to strip those out. bunyan --strict
can do that:
$ node foo.js
{"name":"myapp","hostname":"banana.local","pid":10981,"level":30,"msg":"start","time":"2013-01-10T04:31:44.517Z","v":0}
hi there
{"name":"myapp","hostname":"banana.local","pid":10981,"level":30,"msg":"end","time":"2013-01-10T04:31:44.519Z","v":0}
$ node foo.js | bunyan --strict -j
{
"name": "myapp",
"hostname": "banana.local",
"pid": 10991,
"level": 30,
"msg": "start",
"time": "2013-01-10T04:31:50.881Z",
"v": 0
}
{
"name": "myapp",
"hostname": "banana.local",
"pid": 10991,
"level": 30,
"msg": "end",
"time": "2013-01-10T04:31:50.883Z",
"v": 0
}
$ node foo.js | bunyan --strict -j | json -gj
[
{
"name": "myapp",
"hostname": "banana.local",
"pid": 11002,
"level": 30,
"msg": "start",
"time": "2013-01-10T04:31:53.980Z",
"v": 0
},
{
"name": "myapp",
"hostname": "banana.local",
"pid": 11002,
"level": 30,
"msg": "end",
"time": "2013-01-10T04:31:53.982Z",
"v": 0
}
]
Is that workable for you?
from node-bunyan.
Thanks for the tip!
On another note, I think it might be helpful to show on the doc page how you can take an existing file and cat it to bunyan... Like:
$ cat my.log | bunyan
from node-bunyan.
Noted. Leaving this ticket open to remember to add docs for this kind of thing.
from node-bunyan.
I think ideally this would be integrated into bunyan as it's much more discoverable that way, but it sounds like there are definitely good solutions, so I'm OK either way. Especially if it's clearly documented.
from node-bunyan.
Related Issues (20)
- Add extra metada into log record HOT 1
- Create SECURITY.md
- Bunyan CLI weirdly suppresses output from node's `readline.prompt()` - `mute-stream` and `read` therefore don't work correctly with bunyan HOT 2
- How do I specify the parent caller as the path to log out when `src` is enabled? HOT 1
- Transform stream/`.pipe` are not working as expected
- Verify high CPU usage on journald HOT 1
- Update version of moment to fix CVE-2022-24785
- How can I get logLevels to show as String values like INFO instead of 30 in the log file ? HOT 1
- Update version of moment to fix GHSA-wc69-rhjr-hc9g (CVE-2022-31129) HOT 8
- `v` always 0 despite bunyan version 1.x released and version 2.x in the making HOT 1
- Inconsistent behaviour on Windows with PowerShell
- provide credentials by passing the username and password parameters for elastic user
- Handle non-function `cause` field in error serializer HOT 3
- Bunyan fails to log 'src' when running in Node 20 versus Node 18
- Change time zone to local time in createLogger
- Next.js middleware runtime not supported HOT 4
- Provide capability to redact sensitive information HOT 1
- Remove/replace dependency on MV HOT 3
- Fix beta releases
- QUESTION: MDC support for bunyan like java logback and log4j had???? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-bunyan.