Query Code Extension Logs by Using Salesforce CLI

Use Salesforce CLI to query logs generated for code extension runs and export them to a file. Logs are stored in the Data Lake Object (DLO) named DataCustomCodeLogs__dll, and you can query them like any other DLO. Salesforce CLI is useful when you want to read multiline messages, such as stack traces, or export results to a CSV file for offline analysis.

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 Salesforce CLI:Permission set:
  • Data Cloud Architect
  • Latency: Logs typically appear within a few minutes after code execution. Allow up to about 10 minutes.
  • Message limits: The maximum log message length is 31,072 characters. Longer messages are truncated.
  • Readability: Multiline messages, such as stack traces, are easier to read in Salesforce CLI output or in an exported CSV file.
  1. Understand the relevant fields of the DataCustomCodeLogs__dll DLO.

    Field (API Name)DescriptionData type
    EventId__cDLO primary key for each log recordUUID
    Timestamp__cLog record timestampDatetime
    Message__cYour log messageText
    CorrelationId__cCorrelates your code extension logs to Data 360 internal logsUUID
    ExecutionId__cUnique identifier for the code execution; multiple CorrelationId__c can share one executionUUID
    DataCustomCodeName__cCode extension package nameText
    ProcessDefinitionName__cName of the batch data transform or search index that uses the code packageText
    UsedInFeature__cFeature where the code is used, for example, batch data transform or search indexText
    OrgId__cOrg identifierText
  2. Confirm that you’re signed in to your target org.

  3. Query the DataCustomCodeLogs__dll DLO with the sf data query command.

  4. To export the results to a CSV file, add --result-format csv and redirect the output to a file. A CSV file preserves multiline messages, such as stack traces, in a readable format.

  • Filter by transform (process) name.
  • Filter by code extension package name.
  • Filter by execution ID.

You can also use Salesforce CLI to describe an object and list its fields. This capability is helpful when the target data model object (DMO) already exists and you’re building the output schema in your config.json. You can see the exact field names and types to include.

The sf sobject describe --json command returns the object’s complete metadata, which is lengthy. To show only each field’s name, type, and label, the examples pipe the output to jq, a command-line JSON processor. jq is a separate tool that isn’t included with Salesforce CLI. If you don’t have jq, run the command without the | jq ... part to see the full response.

  • Describe the logs DLO.
  • Describe a DMO to view the fields for your config.json output schema.