LogicMonitor Forwarder (via JS Forwarder)
This guide explains how to forward logs from Apica Ascent / Flow to LogicMonitor using JS Code Forwarding (custom forwarder). This approach is recommended when the destination does not provide a native OTLP ingestion endpoint for logs, and instead expects REST/JSON (as LogicMonitor does).
Overview
LogicMonitor’s Logs Ingestion API accepts log events over HTTPS as JSON (REST API), and supports authentication using LMv1 tokens or Bearer tokens.
Apica’s JS Code Forwarding lets you take the batched events Apica has ingested (Events) and forward them to a custom HTTP endpoint using fetchSync(url, cfg).
Prerequisites
Logs are already being ingested into Apica Ascent
You have permission in Apica to create and map forwarders
You have a LogicMonitor account name (subdomain) and an API auth method:
Bearer token (recommended for simplicity), or
LMv1 token (requires request signing)
LogicMonitor endpoint and authentication
Endpoint
LogicMonitor Logs Ingestion API endpoint format:
Authentication options
LogicMonitor documents two supported auth methods for the log ingestion API:
Bearer token
LMv1 API token (
Authorization: LMv1 <AccessId>:<Signature>:<Timestamp>)
Recommendation: Use a Bearer token for the JS forwarder when possible, because LMv1 requires generating an HMAC signature per request. LogicMonitor provides background on bearer tokens in their docs.
Create the JS Code Forwarder in Apica
In the Ascent UI, navigate to Forwarders
Select Create Forwarder
Choose JS Code Forwarding
Paste a JS script similar to the examples below
Save the forwarder
Apica’s JS code environment provides:
Events: a batch array of ingested eventsfetchSync(url, cfg): synchronous HTTP request helperconsole.log()for debugging
Example: Forward logs to LogicMonitor using a Bearer token (recommended)
LogicMonitor requires log events to include
msgormessage(the log message). This example maps whatever message field you have intomsg.
This uses Apica’s fetchSync and the built-in Events array.
Example: Using LMv1 authentication (advanced)
LogicMonitor’s docs show the LMv1 Authorization header format required by the log ingestion API.
Because LMv1 requires generating Signature (HMAC-SHA256 + Base64) per request, use this option only if:
you must use LMv1, and
your Apica JS environment supports the necessary crypto functions (or you have an approved implementation approach).
If you want, tell me whether Apica JS forwarder runtime includes crypto helpers (or show me your “available functions” list from that editor), and I’ll provide an LMv1-ready snippet.
Map the forwarder to your log sources
Creating the forwarder does not automatically forward all logs. After saving it:
Go to Explore
Select the application/namespace you want to forward
Use the Actions (⋯) menu
Select Map Forwarder
Choose your JS Code Forwarding forwarder
Save
(Forwarder mapping is part of the standard Apica forwarding workflow.)
Last updated
Was this helpful?