Working with OTel
Gonzo can act as an OpenTelemetry Protocol (OTLP) log receiver, accepting logs directly from OpenTelemetry-instrumented applications.
Basic OTLP Setup
# Start Gonzo as OTLP receiver
gonzo --otlp-enabled
# Custom ports
gonzo --otlp-enabled --otlp-grpc-port=5317 --otlp-http-port=5318
# OTLP with file backup
gonzo --otlp-enabled -f backup.log --follow
Default Endpoints:
gRPC:
localhost:4317
HTTP:
http://localhost:4318/v1/logs
OpenTelemetry Collector Configuration
OpenTelemetry Collector (otelcol) config:
# otel-collector-config.yaml
exporters:
otlp/gonzo_grpc:
endpoint: localhost:4317
tls:
insecure: true
service:
pipelines:
logs:
receivers: [filelog, otlp]
processors: [batch]
exporters: [otlp/gonzo_grpc]
Start collector:
otelcol --config=otel-collector-config.yaml
Application Integration
Python Application:
from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
from opentelemetry.sdk._logs import LoggerProvider
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
# Configure OTLP exporter
otlp_exporter = OTLPLogExporter(
endpoint="localhost:4317",
insecure=True
)
# Set up logging pipeline
logger_provider = LoggerProvider()
logger_provider.add_log_record_processor(
BatchLogRecordProcessor(otlp_exporter)
)
# Your application logs now flow to Gonzo
import logging
logging.info("This log will appear in Gonzo!")
Node.js Application:
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { OTLPLogExporter } = require('@opentelemetry/exporter-logs-otlp-grpc');
const sdk = new NodeSDK({
logRecordProcessor: new BatchLogRecordProcessor(
new OTLPLogExporter({
url: 'http://localhost:4317',
})
),
});
sdk.start();
OTLP Advantages
Why Use OTLP with Gonzo:
✅ Native integration - Structured log data preserves all attributes ✅ Real-time streaming - Logs appear immediately as they're generated ✅ Metadata preservation - Service names, trace IDs, and custom attributes ✅ Standardized format - Works with any OpenTelemetry-compatible application ✅ Scalable architecture - Handle logs from multiple services simultaneously
Use Cases:
Microservice architectures - Centralized log collection from all services
Cloud-native applications - Integration with OpenTelemetry ecosystems
Real-time monitoring - Immediate visibility into application behavior
Distributed tracing correlation - Logs automatically linked to traces
OTLP Issues
# Connection refused
# Check if Gonzo is listening:
netstat -ln | grep 4317
# No logs appearing
# Verify OTLP configuration:
curl -X POST http://localhost:4318/v1/logs -d '{}'
# Port conflicts
# Use custom ports:
gonzo --otlp-enabled --otlp-grpc-port=5317
What's Next?
Now that you understand all input methods, explore these advanced topics:
Filtering & Search - Find exactly what you need in your logs
Configuration - Set up persistent input configurations
Integration Examples - Real-world input scenarios
AI Integration - Add intelligence to your log analysis
You now have complete mastery over getting data into Gonzo! 🚀 Whether you're analyzing static files, monitoring real-time streams, or integrating with OpenTelemetry, you know the optimal approach for every scenario.
Last updated