EC2 Instance
Send logs and hostmetrics from AWS EC2 instance using OpenTelemetry
This guide will help you instrument your AWS EC2 instance with OpenTelemetry and smoothly send the logs and host metrics to a Last9.
Pre-requisites
-
You have a AWS EC2 instance and workload running in it.
-
You have signed up for Last9, created a cluster, and obtained the following OTLP credentials from the Integrations page:
endpoint
auth_header
-
Optional: Attach an IAM policy to the EC2 instance with
ec2:DescribeTags
permission. This is needed for resource detection processor to fetch additional tags associated with the EC2 instance which can be used as additional resource attributes. -
Install Otel Collector. There are multiple ways to install the Otel Collector. One possible way of installing it using rpm is as follows. Every Collector release includes APK, DEB and RPM packaging for Linux amd64/arm64/i386 systems.
Note: systemd is required for automatic service configuration.
More installation options can be found here.
Note: We recommend installing
otel-collector-contrib
version0.103.0
.
Sample Otel Collector Configuration
The default path for otel config is /etc/otelcol-contrib/config.yaml
.
You can edit it and update it with below configuration.
The configuration is annotated with comments which should be addressed before applying the configuration. The configuration for operators is especially important to extract the timestamp
and severity
.
For JSON logs, you can use json_parser
and use its keys for log attributes. For non-structured logs, use the regex_parser
.
The configuration provdies sample example of both JSON parser and regex parsers.
Running otel collector
Run the otel collector using systemctl
command.
Checking logs of otel collector
This will enable logs and host metrics to be sent to Last9. You can visit the Logs Dashboard and Metrics Dashboard to see the data in action.
Troubleshooting
Please get in touch with us on Discord or Email if you have any questions.