Skip to content
Discussion options

You must be logged in to vote

I found this solution:

Change "codec" for "source" to "bytes".

sources:
  http_server_in:
    type: http_server
    address: 0.0.0.0:8090
    decoding:
      codec: "bytes"
    framing:
      method: "newline_delimited"

transforms:
  add_labels:
    inputs: [http_server_in]
    type: remap
    file: add_labels.vrl

sinks:
  out:
    inputs: ["add_labels"]
    type: console
    encoding:
      codec: "json"
    framing:
      method: "newline_delimited"

In the vrl file:

., err = parse_json(.message)
if err != null { abort }
.a = "1"

The output skips broken JSON lines and doesn't add extra tags:

{"a":"1","b":"2"}

Is this the best solution?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pront
Comment options

Answer selected by pront
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
domain: vrl Anything related to the Vector Remap Language
2 participants