Using only documented functions in jq, you first can pair the entries in your array up like so:
$ jq '[range(0;length;2) as $i | .[$i:$i+2]]' file
[
[
{
"key": "@timestamp",
"value": "2024-08-21 03:02:57.871"
},
{
"key": "@message",
"value": "Aug 21, 2024 1:00:11 PM AEST INFO [com.boomi.util.LogUtil doLog] Node is using valid java"
}
],
[
{
"key": "@timestamp",
"value": "2024-08-21 03:02:42.332"
},
{
"key": "@message",
"value": "Aug 21 13:02:37 ip-10-250-122-60 auditd[3013]: Audit daemon rotating log files"
}
]
]
Then map from_entries to each of the new array's entries:
$ jq '[range(0;length;2) as $i | .[$i:$i+2]] | map(from_entries)' file
[
{
"@timestamp": "2024-08-21 03:02:57.871",
"@message": "Aug 21, 2024 1:00:11 PM AEST INFO [com.boomi.util.LogUtil doLog] Node is using valid java"
},
{
"@timestamp": "2024-08-21 03:02:42.332",
"@message": "Aug 21 13:02:37 ip-10-250-122-60 auditd[3013]: Audit daemon rotating log files"
}
]
An alternative approach, which does not deal with indexing the original array in a special way, is to group the array's entries by the key to separate the @message and @timestamp entries from each other. You may then transpose the resulting grouped array and map from_entries as before:
$ jq 'group_by(.key) | transpose | map(from_entries)' file
[
{
"@message": "Aug 21, 2024 1:00:11 PM AEST INFO [com.boomi.util.LogUtil doLog] Node is using valid java",
"@timestamp": "2024-08-21 03:02:57.871"
},
{
"@message": "Aug 21 13:02:37 ip-10-250-122-60 auditd[3013]: Audit daemon rotating log files",
"@timestamp": "2024-08-21 03:02:42.332"
}
]
This relies on group_by() not changing the ordering between entries with the same key (tests suggest that jq employs a stable sorting algorithm, so this should be ok).