Vector
Sending Logs with Vector
This guide demonstrates how to send logs to Metoro using Vector and the OpenTelemetry Collector. This setup provides a robust and scalable way to collect and forward logs to Metoro.
For a complete working example, see our Vector Logs Example repository.
You must add a service.name
attribute to your logs. This attribute is required by Metoro to properly organize and display your logs. You can set this using Vector’s transforms (shown below) or directly in your application logging configuration.
Architecture
The setup consists of two main components:
- Vector: Acts as the log collector and forwarder. In this example, it generates sample syslog messages and forwards them to the OpenTelemetry Collector.
- OpenTelemetry Collector: Receives logs from Vector, processes them, and forwards them to Metoro in the correct OpenTelemetry format.
Vector Configuration
Vector needs to be configured to forward logs to the OpenTelemetry Collector. Here’s the sink configuration:
Vector Source Options
Vector supports many different sources for collecting logs:
kubernetes_logs
: Collect logs from Kubernetes containersfile
: Read logs from filessyslog
: Accept syslog messagesjournald
: Read from systemd journal- And many more
OpenTelemetry Collector Configuration
The OpenTelemetry Collector needs to be configured to receive logs from Vector and forward them to Metoro. Here’s the configuration:
OpenTelemetry Collector Components
-
Receivers: Configure how the collector receives data
- In this case, we use the syslog receiver on port 1514
- Supports RFC5424 format syslog messages
-
Processors: Configure data processing
- Batch processor groups logs for efficient sending
- Adjustable timeout and batch size settings
-
Exporters: Configure where to send the data
- Uses OTLP HTTP protocol to send to Metoro
- Endpoint points to your Metoro instance
Customization
Log Sources
To collect logs from your applications, configure an appropriate Vector source for your use case. See the Vector documentation for available source types and their configurations.
Batch Settings
Adjust the batch processor settings in the OpenTelemetry Collector for your needs:
Troubleshooting
Common issues and solutions:
-
Vector can’t connect to the OpenTelemetry Collector:
- Verify the collector address is correct
- Check that the collector is listening on the specified port
- Ensure network connectivity between Vector and the collector
-
Logs not appearing in Metoro:
- Check the OpenTelemetry Collector logs for errors
- Verify the Metoro endpoint is correct
- Check that logs are being received by the collector
Next Steps
- Configure Vector to collect your application logs
- Add filters and transforms in Vector to process logs
- Set up monitoring for Vector and the OpenTelemetry Collector
- Configure log retention and archival policies
Was this page helpful?