Send Application/Server Logs from EC2 to SigNoz

Introduction

This documentation provides detailed instructions on how to send application and server logs from an EC2 instance to SigNoz. By integrating with SigNoz, you can efficiently collect, monitor, and analyze your logs for better insights into your applications and servers.

Prerequisites

  • A Linux-based EC2 instance

Install OpenTelemetry Collector

You can install OpenTelemetry collector as an agent on your Virtual Machine by following this guide. The OpenTelemetry collector provides a vendor-neutral way to collect, process, and export telemetry data such as logs, metrics, and traces.

Dummy Log File

As an example, use a sample log file called app.log with the following dummy data:

This is log line 1
This is log line 2
This is log line 3
This is log line 4
This is log line 5

This file represents a log file of your application/server.

Configure Filelog Receiver

Receivers are used to get data into the collector. A filelog receiver collects logs from files. Modify the config.yaml file that you created while installing the OTel collector to include the filelog receiver. Specify the path to your app.log file (or your actual log file) and set the start_at parameter.

config.yaml
receivers:
  filelog/app:
    include: [ /tmp/app.log ] # include the full path to your log file
    start_at: end
📝 Note

The start_at: end configuration ensures that only newly added logs are transmitted. If you wish to include historical logs from the file, set start_at to beginning.

Update Pipeline Configuration

Receivers must be enabled via pipelines within the service section of the collector config file. Update the pipeline configuration in config.yaml:

config.yaml
service:
  pipelines:
    logs:
      receivers: [otlp, filelog/app]
      processors: [batch]
      exporters: [otlp]

Restart the OpenTelemetry Collector by following the steps outlined in this guide.

Verifying the Exported Logs

The logs will be exported to the SigNoz Cloud UI. If you add more entries to your app.log file, they will also appear in the SigNoz Logs Explorer.

Logs of the dummy app.log file visible in SigNoz
Dummy log file data shown in SigNoz Logs Explorer

Was this page helpful?