Setting Up Service Logging
Batch uses the OCI Logging service to capture and store logs produced by tasks. Setting up log groups and log objects in advance ensures you can monitor, debug, and audit the workloads.
To allow Batch workloads to write logs to OCI Logging, add the following IAM policies:
Allow any-user to manage log-content in compartment <your_compartment> where ALL { request.principal.type = 'batchcontextinfrastructure' }
For more information, see Creating a Log Group and Creating a Log.
OCI Batch produces three types of logs and sends them to OCI Logging. You can configure the destination in the batch context.
Log Types
- Task runtime logs: Output produced by tasks while they run.
- Lifecycle event logs: Events that record state changes for jobs and tasks.
Task Execution Log Example
The following example is for type: "type": "com.oraclecloud.batch.task.execution",
Note
We also publish job and task lifecycle logs with types:
We also publish job and task lifecycle logs with types:
"com.oraclecloud.batch.job.lifecycle""com.oraclecloud.batch.task.lifecycle"
{
"datetime": 1776437873408,
"logContent": {
"id": "<log content ID>",
"time": "2026-04-17T14:57:53.408Z",
"oracle": {
"compartmentid": "<compartment OCID>",
"ingestedtime": "2026-04-17T14:57:59.740125380Z",
"loggroupid": "<log group OCID>",
"logid": "<log OCID>",
"tenantid": "tenant OCID"
},
"source": "<source ID>",
"specversion": "1.0",
"subject": "",
"type": "com.oraclecloud.batch.task.execution",
"data": {
"batchContextId": "<batch context OCID>",
"batchFleetName": "BatchTestFleet",
"batchJobId": "<batch job OCID>",
"batchJobPoolId": "<batch pool OCID>",
"batchTaskName": "t1",
"batchTaskRunId": "<batch task run ID>",
"job": {
"OCF_FARM_ID": "<ocf farm OCID>",
"OCF_FLEET_NAME": "BatchTestFleet",
"OCF_JOB_ID": "<ocf job OCID>",
"OCF_JOB_POOL_ID": "<ocf job pool OCID>",
"OCF_TASK_NAME": "t1",
"OCF_TASK_RUN_ID": "<ocf task run ID>"
},
"message": "dr-xr-xr-x 1 root root 4096 Apr 17 14:57 .."
}
},
"regionId": "us-ashburn-1"
}