Skip to content

How to handle a json array log #11248

Answered by spencergilbert
satscreate asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @satscreate,

First off I think you "running" command is a bit off, you should use jq -c '.' sample.jsonl | vector -c vector.yaml instead. The json decoder on your stdin source is going to take your array of objects and parse them into two events:

jq -c '.' sample.jsonl | vector -c vector.yaml
2022-02-08T16:41:38.530333Z  INFO vector::app: Log level is enabled.
...
{"host":"COMP-C02F514NML87","id":"1","source_type":"stdin","timestamp":"2022-02-08T16:41:38.532531Z","val":"1.0"}
{"host":"COMP-C02F514NML87","id":"2","source_type":"stdin","timestamp":"2022-02-08T16:41:38.532531Z","val":"2.0"}

Today the decoding feature is always going to parse and merge the object into the root of the event…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by satscreate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants