Skip to content

transform output square brackets #21874

Answered by jszwedko
RFskynet asked this question in Q&A
Nov 24, 2024 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Correct, if an array is emitted by a remap transform than each element is then emitted as a separate event per mapping one log into multiple.

I think here you may want to actually do the encoding in remap to avoid this. Something like:

[sources.files]
type = "file"
include = [ "/etc/vector/log1.log" ]

[transforms.vector-transform]
inputs = ["files"]
type = "remap"
source = """
. = {"message": encode_json([.])}
"""
[sinks.file_output]
type = "file"
inputs = ["vector-transform"]
path = "/etc/vector/log2.log"
encoding.codec = "text"

Using the text codec should result in only the message field being output.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@RFskynet
Comment options

@pront
Comment options

pront Dec 2, 2024
Maintainer

@RFskynet
Comment options

@jszwedko
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
None yet
3 participants