Skip to main content

AmpliServ Backend SDK Integration Guide

Overview

The AmpliServ Backend SDK enables seamless log collection, enrichment, and transmission from your backend applications to the AmpliServ observability platform. The SDK provides automatic log tailing, batch processing, incident detection, and correlation ID propagation.

Architecture

┌─────────────────┐       ┌──────────────┐       ┌─────────────────┐       ┌─────────────┐
│ Your Backend │────▶│ app.log │────▶│ AmpliServ SDK │────▶│ AmpliServ │
│ Application │ │ (JSON logs) │ │ Agent │ │ Cloud │
└─────────────────┘ └──────────────┘ └─────────────────┘ └─────────────┘


┌─────────────┐
│ Kibana/ │
│ Grafana │
└─────────────┘

Key Features

FeatureDescription
Automatic Log CollectionTails log files in real-time
JSON Log ParsingExtracts structured data from JSON logs
Batch ProcessingGroups logs into batches for efficient transmission
Incident DetectionDetects error spikes and panic patterns
Correlation ID SupportPreserves request tracing across services
Multiple Deployment ModesFile, Docker, Kubernetes, Fluent Bit
Retry with BackoffAutomatic retry on transmission failures

Quick Start

1. Configure Your Backend for JSON Logging

Your application must output logs in JSON format to a file. The SDK will tail this file.

2. Download the AmpliServ Agent

# Download the appropriate binary for your OS
# Windows: ampliserv-agent.exe
# Linux: ampliserv-agent
# macOS: ampliserv-agent

3. Configure Environment Variables

# Required
export AMPLISERV_API_KEY="your-api-key"
export AMPLISERV_LOG_PATH="/path/to/your/app.log"

export AMPLISERV_ENDPOINT="https://ingest.ampliserv.io/v1/ingest/logs"
export AMPLISERV_SERVICE_NAME="your-service-name"
export AMPLISERV_ENV="production"
export AMPLISERV_BATCH_SIZE="50"
export AMPLISERV_FLUSH_INTERVAL_SEC="5"
export AMPLISERV_INCIDENT_ENABLED="true"

4. Run the SDK Agent

./ampliserv-agent

Supported Frameworks

FrameworkIntegration Guide
Java / Spring BootView Guide →
Python / Django / FlaskView Guide →
Node.js / Express.jsView Guide →
.NET Core / C#View Guide →
C++View Guide →

Deployment Modes

File Mode (Default)

Tails a specific log file on the filesystem.

Docker Mode

Automatically discovers and tails logs from Docker containers.

Kubernetes Mode

Tails logs from /var/log/containers/*.log with pod metadata extraction.

Fluent Bit Mode

Accepts logs via HTTP from Fluent Bit sidecar.

Log Format Requirements

The SDK expects logs in JSON format with the following structure:

{
"timestamp": "2026-03-23T10:30:45.123Z",
"level": "ERROR",
"message": "Error message here",
"correlation_id": "uuid-here",
"stack_trace": "Optional stack trace",
"service": "your-service",
"environment": "production"
}

What the SDK Adds

When the SDK processes your logs, it enriches them with:

FieldDescription
agent_idUnique identifier of the SDK agent
agent_versionVersion of the SDK
hostHostname where the agent runs
container_idDocker container ID (if applicable)
pod_nameKubernetes pod name (if applicable)
namespaceKubernetes namespace (if applicable)

Incident Detection Rules

The SDK automatically detects and reports:

RuleTrigger ConditionSeverity
PANICpanic:, fatal error:, segmentation faultCRITICAL
ERROR_SPIKE10+ errors in 1 minuteHIGH

Troubleshooting

IssueSolution
SDK can't read log fileCheck file permissions
No logs being sentVerify AMPLISERV_LOG_PATH is correct
JSON parsing errorsEnsure logs are valid JSON
Connection refusedVerify endpoint URL and network connectivity

View full troubleshooting guide →

Support

  • Documentation: docs.ampliserv.io
  • Issues: github.com/ampliserv/agent/issues
  • Email: support@ampliserv.io