How to Use Integration Logs with IFX (API only)
IFX provides logs for integrations. These logs are helpful for debugging integrations or logging important details. This guide walks you through how to use the logs API.
Logging Policies
Arc XP maintains high security standards with regular auditing. IFX integrations should always consider security risks such as outputting sensitive data in logs, especially in a production environment. Additionally, integration logs will be automatically purged after 30 days.
Integrations should not:
- Use DEBUG on a production environment unless actively debugging, then turn it off
- Expose sensitive data in logs, especially a production environment
- Send or receive unencrypted payment information such as credit card numbers
- Send or receive any unencrypted sensitive data
Security and reliability are always concerns when integrating with third-parties. It’s common for third-party libraries to have Security Vulnerabilities, or even for the packages To Be Removed Entirely From NPM. When integrating third-party libraries, make sure the code is from a reputable source, check it as thoroughly as possible, and keep your versions up-to-date!
Add Logs to Integration
Simply use console.log
. If you would like a more comprehensive guide, you can read Node.js v18.14.2 documentation or Mozilla’s console.log() documentation.
IFX Log API
IFX Admin APIOn Sandbox and Prod, IFX Log API can be used to view integration logs.
Replace $ORG with your org id and $PAT with the PAT you got from the Developer Center.
1. Request a queryId
curl --location --request GET 'https://api.sandbox.$ORG.arcpublishing.com/ifx/api/v1/admin/logs/integration/:integrationName' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer $PAT' \--data-raw ''
You should get a response with a queryId
:
{ "queryId": "abcdef12-b766-4e71-868a-a58715f55ebb"}
The default time is 300s (5m). If your logs are older you can use the start
parameter to change the time in seconds:
/ifx/api/v1/admin/logs/integration/:integrationName?start=10000
2. View the Logs with the queryId
Use the queryId
to call the logs API and view the results.
curl --location --request GET 'https://api.sandbox.$ORG.arcpublishing.com/ifx/api/v1/admin/logs/results?queryId=abcdefg-b766-4e71-868a-a58715f55ebb' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer $PAT' \--data-raw ''
You should get a response like below where the messages under the events
object are your integration’s logs:
{ "statistics": { "recordsScanned": 19, "bytesScanned": 1738, "recordsMatched": 3 }, "events": [ { "timestamp": "2022-03-10 16:45:01.733", "eventId": "Cl9y8wpdvgpfcvOBNAyg1IsBNQgQwQERgB", "message": "END RequestId: 81d3d7b6-4fb0-44eb-a9be-b026e3d03dbd\n" }, { "timestamp": "2022-03-10 16:45:01.733", "eventId": "+Cl9y8wpdvgpfcvOBNAyg1IsBNQgQwQEhgB", "message": "REPORT RequestId: 81d3d7b6-4fb0-44eb-a9be-b026e3d03dbd\tDuration: 4.36 ms\tBilled Duration: 5 ms\tMemory Size: 512 MB\tMax Memory Used: 216 MB\t\nXRAY TraceId: 1-622a2b0d-18725169385f2b6c49dc6713\tSegmentId: 03a858531d7454c4\tSampled: true\t\n" }, { "timestamp": "2022-03-10 16:45:01.731", "eventId": "+Cl9y8wpdvgpfcvOBNAyg1IsBNQgQwQDhgB", "message": "Received event key SCHEDULE_EVENT\n" } ], "status": "Complete"}
If the status is Scheduled or Running, you should wait for few seconds and call the API again to view complete results.
Help us improve our documentation! Let us know if you do not find what you are looking for by posting suggestions to Our Ideas Portal.