Details for Functions

Logging details for Functions logs.

Resources

  • applications

Log Categories

API value (ID): Console (Display Name) Description
invoke Function Invocation Logs Logs entries each time a function in an application is invoked.

Availability

Functions logging is available in all the regions of the commercial realms.

Comments

If you enable logging for an application, default invocation logs are created whenever functions in the application are invoked, as follows:

  • The default invocation start log contains the following message:

    Received function invocation request
  • The default invocation end log contains the following message (an error code is only included if errors occur):

    Served function invocation request in <number> seconds [with error code <number> - <message>]

To store and view logs for a function (other than the default invocation logs), you must add print statements to your function. For example:

  • For node js:

    console.log('Entering Hello Node.js function');
  • For java:

    System.out.println("Entering Java Hello World Function");
  • For go:

    fmt.Println("Entering Hello Go function")

Contents of a Functions Log

Property Description
specversion Oracle Cloud Infrastructure logging schema version of the log.
type Category of log, following convention com.oraclecloud.{service}.{resource-type}.{log-category}. Currently only:
com.oraclecloud.functions.application.functioninvoke
source Display name of the application the log is associated with.
subject Display name of the function the log is associated with.
id Random UUID, unique to each log entry.
time Time the function output was generated, in RFC 3339 timestamp format.
oracle.logid OCID of the Oracle Cloud Infrastructure Logging log object.
oracle.loggroupid OCID of the Oracle Cloud Infrastructure Logging log group.
oracle.compartmentid OCID of the compartment the function/application is in.
oracle.tenantid OCID of the tenancy the function/application is in.
oracle.ingestedtime Time the log line was ingested by Oracle Cloud Infrastructure logging, in RFC 3339 timestamp format.
data.applicationId OCID of the application the log line is associated with.
data.containerId FaaS service-specific ID of the function's container.
data.functionId OCID of the function the log line is associated with.
data.requestId Oracle RID of the function invocation the log line is associated with. Deprecated, use data.opcRequestId instead.
data.opcRequestId Oracle RID of the function invocation the log line is associated with.
data.src I/O stream origin of data.message. Either STDOUT or STDERR.
data.message User-generated line of output from the function.

An Example Functions Log

{
  "specversion": "1.0",
  "type": "com.oraclecloud.functions.application.functioninvoke",
  "source": "Application display name",
  "subject": "Function display name",
  "id": "487c8669-f384-4c79-950a-d6df47246093",
  "time": "2020-08-19T15:33:29.000Z",
  "oracle": {
    "logid": "ocid1.log.oc1.iad.<unique_ID>",
    "loggroupid": "ocid1.loggroup.oc1.iad.<unique_ID>",
    "compartmentid": "ocid1.compartment.oc1..<unique_ID>",
    "tenantid": "ocid1.tenancy.oc1..<unique_ID>",
    "ingestedtime": "2020-08-19T15:33:30.832Z"
  },
  "data": {
    "applicationId": "ocid1.fnapp.oc1.iad.<unique_ID>",
    "containerId": "01EG3NMHG6000000000000022S",
    "functionId": "ocid1.fnfunc.oc1.iad.<unique_ID>",
    "requestId": "/01EG3NN3C11BT19PGZJ00000VZ/01EG3NN3C11BT19PGZJ00000W0",
    "opcRequestId": "/01EG3NN3C11BT19PGZJ00000VZ/01EG3NN3C11BT19PGZJ00000W0",
    "src": "STDERR",
    "message": "2020-08-19 15:33:29,124 - fdk.event_handler - INFO - request execution completed"
  }
}

Functions Log Object Name

Objects that store Functions log data use the following naming format:

log/<function-OCID>/<YYYY-MM-DDTHH_MMZ>[_<seqNum>].log.gz

For example:

log/ocid1.function.oc1.phx.<unique_ID>/2019-03-21T00_00Z.log.gz
log/ocid1.function.oc1.phx.<unique_ID>/2019-03-21T00_00Z_2.log.gz

Using the Command Line Interface (CLI)

See Functions Example for an example command to enable Functions logging.