Azure Service Apps
Monitor Azure Service Apps with logging using OpenTelemetry sidecar container integration with Last9
Use OpenTelemetry to instrument your Azure Service Apps and send logs to Last9.
This guide outlines the steps to setup Azure Service Apps to send logs to Last9 using OpenTelemetry Collector as a sidecar container.
Prerequisites
Before setting up Azure Service Apps monitoring, ensure you have:
- Azure Service Apps with sidecar container
- Azure File Share
- Last9 account with integration credentials
-
Configure Environment Variables
Set the environment variable
OTEL_SERVICE_NAMEto the service name of the application that is running in the container.Enable the necessary logs such as Service specific logs or HTTP logs in Azure Service Apps.
-
Setup OpenTelemetry Collector Sidecar Container
Create a sidecar container with the following configuration:
- Registry:
index.docker.io - Image:
otel/opentelemetry-collector-contrib:0.118.0 - Port:
4318 - Command:
--config /otelconfig/config.yaml --feature-gates transform.flatten.logs
- Registry:
-
Setup Azure File Share for OpenTelemetry Collector Configuration
Create a file share in Azure Storage Account and mount it to the sidecar container at
/otelconfig.Upload the following configuration file to the file share as
config.yaml.The configuration picks up logs from the Azure Service Apps and sends them to Last9 from
/home/LogFiles/*.log.receivers:otlp:protocols:grpc:endpoint: 0.0.0.0:4317http:endpoint: 0.0.0.0:4318# Detailed configuration options can be found at https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiverfilelog:# File path pattern to read logs from. Update this to the destination from where you want to read logs.# Azure Service Apps writes logs to */home/LogFiles/*.log*include: [/home/LogFiles/*.log]include_file_path: true# attributes:# A map of key: value pairs to add to the entry's attributes.resource:# A map of key: value pairs to add to the entry's resource.deployment.environment: "deployment-environment"service.name: "service-name" # You can use the environment variable `OTEL_SERVICE_NAME` to set this value.# Add additional resource attributes as needed.retry_on_failure:enabled: trueprocessors:batch:timeout: 5ssend_batch_size: 10000send_batch_max_size: 10000transform/add_timestamp:error_mode: ignoreflatten_data: truelog_statements:- context: logconditions:- time_unix_nano == 0statements:- set(observed_time, Now())- set(time_unix_nano, observed_time_unix_nano)resourcedetection/azure:detectors: [env, azure]timeout: 2soverride: falseexporters:debug:verbosity: detailedotlp/last9:endpoint: "{{ .Logs.WriteURL }}"headers:"Authorization": "{{ .Logs.AuthValue }}"service:pipelines:logs:receivers: [filelog]processors: [resourcedetection/azure, transform/add_timestamp, batch]exporters: [otlp/last9]
Verification
Once the sidecar container is running, the logs will be sent to Last9. You can verify this by checking the Logs Explorer in Last9. For debugging, you can look at the logs in the sidecar container.
Need Help?
If you encounter any issues or have questions:
- Join our Discord community for real-time support
- Contact our support team at support@last9.io