Use the Data 360 Query API to programmatically retrieve logs generated for code extension runs. Logs are stored in the Data Lake Object (DLO) named DataCustomCodeLogs__dll. You can query them like any other DLO.
| Edition Table |
|---|
| Available in: Developer, Enterprise, Performance, and Unlimited Editions. See Data 360 edition availability. |
| User Permissions Needed | |
|---|---|
| To query code extension logs by using the Query API: | Permission set: <ul><li>Data Cloud Architect</li></ul> |
Prerequisites
- Data 360 access with permission to query data
- Enable Code Extension in Data Cloud Setup by using the Feature Manager. See Enable Data 360 Features in Feature Manager.
- Authenticate to the Data 360 Connect API. See Get Started with Data 360 Connect API.
- A completed batch transform or search index run
Considerations
- Latency: Logs typically appear within a few minutes after code execution. Allow up to about 10 minutes.
- Message limits: Maximum log message length is 31,072 characters. Longer messages are truncated.
Steps to Query Code Extension Logs by Using the Query API
-
Understand the relevant fields of the
DataCustomCodeLogs__dllDLO.EventId__c— DLO primary key for each log recordTimestamp__c— Log record timestampMessage__c— Your log messageCorrelationId__c— Correlates your code extension logs to Data 360 internal logsDataCustomCodeName__c— Name of the code extension packageProcessDefinitionName__c— Name of the batch data transform or search index that uses the code packageExecutionId__c— Unique identifier for the code execution. More than oneCorrelationId__ccan share one executionUsedInFeature__c— Feature where the code is used, for example, batch data transformOrgId__c— Org identifier
-
Create your SQL query to query the
DataCustomCodeLogs__dllDLO like any other Data 360 object. See Create sql query.Examples
- Filter by transform (process) name.
curl -X POST "https://{yourInstance}/services/data/v64.0/ssot/query-sql" \ -H "Authorization: Bearer ${ACCESS_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT \"Timestamp__c\", \"Message__c\" FROM \"DataCustomCodeLogs__dll\" WHERE \"ProcessDefinitionName__c\" = '\''MyTransformName'\'' ORDER BY \"Timestamp__c\" DESC LIMIT 100" }'- Filter by code extension package name.
curl -X POST "https://{yourInstance}/services/data/v64.0/ssot/query-sql" \ -H "Authorization: Bearer ${ACCESS_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT \"Timestamp__c\", \"Message__c\" FROM \"DataCustomCodeLogs__dll\" WHERE \"DataCustomCodeName__c\" = '\''my_custom_code'\'' ORDER BY \"Timestamp__c\" DESC LIMIT 100" }'- Filter by execution ID.
curl -X POST "https://{yourInstance}/services/data/v64.0/ssot/query-sql" \ -H "Authorization: Bearer ${ACCESS_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT * FROM \"DataCustomCodeLogs__dll\" WHERE \"ExecutionId__c\" = '\''00000000-0000-0000-0000-000000000000'\'' ORDER BY \"Timestamp__c\" DESC" }'- Filter by correlation ID.
curl -X POST "https://{yourInstance}/services/data/v64.0/ssot/query-sql" \ -H "Authorization: Bearer ${ACCESS_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT * FROM \"DataCustomCodeLogs__dll\" WHERE \"CorrelationId__c\" = '\''00000000-0000-0000-0000-000000000000'\'' ORDER BY \"Timestamp__c\" DESC" }' -
Check the query status. See Get SQL Query Status.
-
(Optional) Retrieve additional rows. If your query returns more data than the initial response, retrieve additional rows. See getSqlQueryRows.