Hi,
I've added some fields (lookups, etc) from a syslog source and trying to push it into the Log Insight API via a webhook.
But, I'm struggling understand how to get it into the format Log Insight wants.
I'll say up front, JSON and Javascript is pretty new to me so be gentle š
The JSON format Log Insight expects isā¦
{āmessagesā: [{
āfieldsā: [
{ānameā: āField1ā, ācontentā: āField1_valueā},
{ānameā: āField2ā, ācontentā: āField2_valueā},
{ānameā: āField_xxxā, ācontentā: āField_Last_xxxā}
],
ātextā: āoriginal messageā,
ātimestampā: timestamp
}
]
}
I've tried the Serialize to JSON, but it doesn't seem to have a way to arrange the fields for it to output in a custom way.
I've seen a post about using Object.fromEntries, but I'm still not able to get working. Not sure if it's even the right way to go.
Converting an array into a simplified JSON object:
Does anyone have a slick way of converting an array where each element is an array of length 2, that contains the key at index 0 and value at index 1, into a JSON object. This is what the original looks like: { "HeadersIn": [ [ "Host", "example.com" ], [ "Accept", "*/*" ], [ "Connection", "keep-alive" ], [ "Cookie", " ], [ ā¦
It's probably something simple, Thank you in advance!
















