Shipping logs from applications deployed on SAP BTP Cloud Foundry can be configured in different ways. Even without any specific application logs, you can analyze your applications based on the automatically issued request logs from the Cloud Foundry router. Further, you can benefit from default contents, such as dashboards, index patterns, and retention settings.
You can also Ingest via OpenTelemetry API Endpoint.
Ensure that you consider SAP BTP Security Recommendation BTP-CLS-0002.
All configuration steps can be done either using SAP BTP Cockpit or the Cloud Foundry Command Line Interface.
Shipping logs from applications deployed on SAP BTP Cloud Foundry can be configured using one of the below options:
- Bind the Application to the Service Instance, optionally using Share Service Instance Across Different Spaces to consolidate observability data across spaces within one organization.
- Bind the Application to a User Provided Service.
- We recommend you use one of the Cloud Foundry open source logging libraries (Java/NodeJS) to configure logging within your application.
Bind the Application Using the Command Line Interface
-
Log On to the Cloud Foundry Environment Using the Cloud Foundry Command Line Interface.
-
To bind the application via command line interface, execute the following command:
cf bind-service <app-name> <service-instance>
Although the command line interface prompts you to restage the app, the binding takes effect without restaging.
-
Go to the Result section.
Bind the Application Using the SAP BTP Cockpit
- Log On to the Cloud Foundry Environment Using the SAP BTP Cockpit.
- Execute Bind Service Instances to Applications Using the Cockpit without binding parameters.
- Go to the Result section.
You can share a single service instance across multiple spaces. Skip this step if you don't need to share a single instance across multiple spaces of the same org.
-
Log on to the Cloud Foundry Environment Using the Cloud Foundry Command Line Interface.
-
To share the services in an additional space, execute the following command:
cf share-service <service-instance> -s <other-space>
-
Go to the Result section.
Be careful when deleting service keys. Credentials are invalidated if the service key is deleted, and there is no automated mechanism to track in which user provided services instances the information of a service key is used.
Bind the Application to the Service Instance is the recommended approach, because of simplicity in setup and maintenance. Introducing an indirection via service key and binding to a user-provided service to send logs is only advisable:
- to reduce the dependency on bind operations in automated procedures.
- to ingest across Cloud Foundry orgs to a single Cloud Logging instance.
Bind the Application to User Provided Service Using the Command Line Interface
-
Log on to the Cloud Foundry Environment Using the Cloud Foundry Command Line Interface.
-
Execute the following command to list the service instances:
cf services
-
Execute the following command to create a service key without binding to any application:
cf create-service-key <service-instance> <service-key>
-
Extract
ingest-endpoint
,ingest-username
, andingest-password
from the response of executing:cf service-key <service-instance> <service-key>
-
Create a user provided service using the following the template filled with the values of the previous step and a user-provided-service-name of your choice:
cf cups <user-provided-service-name> -l https://<ingest-username>:<ingest-password>@<ingest-endpoint>/cfsyslog
-
Proceed with Bind the Application to the Service Instance and bind to the user provided service.
Bind the Application to User Provided Service Using SAP BTP Cockpit
-
Log On to the Cloud Foundry Environment Using the SAP BTP Cockpit.
-
Create a service key according to Creating Service Keys in Cloud Foundry.
-
Create a User-Provided Service following Creating User-Provided Service Instances in Cloud Foundry Environment using
Instance Name
of your choice and the information from the the service key to configureSystem Logs Drain URL
:https://<ingest-username>:<ingest-password>@<ingest-endpoint>/cfsyslog
-
Proceed with Bind the Application to the Service Instance and bind to the user provided service.
The ingested data can be analyzed in OpenSearch Dashboards (see Access and Analyze Observability Data) based on the logs-cfsyslog-*
index pattern.