Q&A - Asking for help with json transform #24105
Answered
by
thomasqueirozb
soda-pop-ice-cream
asked this question in
Q&A
-
QuestionCan anyone please help with VRL that will move all fields to top level of json? When I do [
{
"foo": 0.378,
"bar": 0.184,
"baz": 0
},
{
"foo": 0.759,
"bar": 0.465,
"baz": 0,
},
{
"foo": 0.86,
"bar": 0.726,
"baz": 0,
}
]When I do [
{
"dst": "example.org",
"host": "vector",
"report": {
"hubs": {
"foo": 0.378,
"bar": 0.184,
"baz": 0
}
},
"src": "vector",
"tests": 4,
"timestamp": "2025-10-27T15:17:57.093229337Z",
"tos": 0
},
{
"dst": "example.org",
"host": "vector",
"report": {
"hubs": {
"foo": 0.759,
"bar": 0.465,
"baz": 0
}
},
"src": "vector",
"tests": 4,
"timestamp": "2025-10-27T15:17:57.093229337Z",
"tos": 0
},
{
"dst": "example.org",
"host": "vector",
"report": {
"hubs": {
"foo": 0.86,
"bar": 0.726,
"baz": 0
}
},
"src": "vector",
"tests": 4,
"timestamp": "2025-10-27T15:17:57.093229337Z",
"tos": 0
},
]Unnest do almost that I need, but I can't understand how to pop content of Thank you! Vector Configsources:
mtr_tcp_443:
type: exec
command:
- "mtr"
- "-4"
- "--no-dns"
- "--report-cycles"
- "4"
- "--tcp"
- "--port"
- "443"
- "--json"
- "--order"
- "LSRDNBAWVGJMXI"
- "example.org"
mode: scheduled
scheduled:
exec_interval_secs: 60
include_stderr: false
decoding:
codec: json
framing:
method: bytesVector Logs{
"host": "vector",
"report": {
"hubs": [
{
"foo": 0.378,
"bar": 0.184,
"baz": 0
},
{
"foo": 0.759,
"bar": 0.465,
"baz": 0
},
{
"foo": 0.86,
"bar": 0.726,
"baz": 0
}
],
"mtr": {
"dst": "example.org",
"src": "vector",
"tests": 4,
"tos": 0
}
},
"timestamp": "2025-10-27T15:17:57.093229337Z"
} |
Beta Was this translation helpful? Give feedback.
Answered by
thomasqueirozb
Oct 29, 2025
Replies: 1 comment 2 replies
-
|
Hi @soda-pop-ice-cream, I'm not sure I understand what your desired output is. Can you paste an example input and a desired output? You can also use the VRL playground and share a link here |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you are looking to do something like this. Merge ordering matters so please take a look at the merge documentation also