Skip to content

How to ingest gzip log files and use remap to parse it in json format? #12387

Answered by jszwedko
syzcch asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @syzcch !

Looking at your error messages there, it seems like you might have compressed tar archives? Vector won't read those correctly, only individual compressed files.

To verify Vector's behavior of reading individual files, I tested with:

flog -f json > /tmp/logs.json

(flog is a log generator: https://github.com/seattlerb/flog)

gzip /tmp/logs.json

Running Vector with the below configuration:

data_dir = "/tmp/vector"

[sources.gz_logs]
type = "file"
include = [ "/tmp/log.json.gz" ]

[transforms.parse_logs]
type = "remap"
inputs = ["gz_logs"]
source = '''
. = parse_json!(.message)
'''

[sinks.print]
type = "console"
inputs = ["parse_logs"]
encoding.codec = "json"

And Vector was abl…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@JeanMertz
Comment options

@syzcch
Comment options

@syzcch
Comment options

@spencergilbert
Comment options

@syzcch
Comment options

Answer selected by jszwedko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants