Skip to main content

AmpliServ SDK Configuration Reference

Environment Variables

Required Variables

VariableTypeDescriptionExample
AMPLISERV_API_KEYstringAPI key for authenticationak_xxxxx
AMPLISERV_LOG_PATHstringPath to log file to tail/var/log/app.log

Optional Variables

VariableTypeDefaultDescription
AMPLISERV_ENDPOINTstringhttps://ingest.ampliserv.io/v1/ingest/logsAPI endpoint URL
AMPLISERV_SERVICE_NAMEstringunknown-serviceName of your service
AMPLISERV_ENVstringprodEnvironment (dev/staging/prod)
AMPLISERV_BATCH_SIZEint50Number of logs per batch
AMPLISERV_FLUSH_INTERVAL_SECint5Flush interval in seconds
AMPLISERV_INCIDENT_ENABLEDbooltrueEnable incident detection
AMPLISERV_COLLECTOR_MODEstringfileCollector mode
AMPLISERV_LOG_LEVELstringinfoSDK log level
AMPLISERV_FLUENT_BIT_PORTint0Port for Fluent Bit input

Collector Modes

File Mode

export AMPLISERV_COLLECTOR_MODE="file"
export AMPLISERV_LOG_PATH="/path/to/app.log"

Docker Mode

export AMPLISERV_COLLECTOR_MODE="docker"
# Automatically discovers containers at /var/lib/docker/containers

Kubernetes Mode

export AMPLISERV_COLLECTOR_MODE="k8s"
# Tails logs from /var/log/containers/*.log

Auto Mode

export AMPLISERV_COLLECTOR_MODE="auto"
# Auto-detects environment (K8s > Docker > File)

Docker Deployment

docker run -d \
-e AMPLISERV_API_KEY="your-api-key" \
-e AMPLISERV_COLLECTOR_MODE="docker" \
-v /var/lib/docker/containers:/var/lib/docker/containers:ro \
-v /var/log:/var/log:ro \
ampliserv/agent:latest

Kubernetes Deployment (DaemonSet)

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ampliserv-agent
spec:
template:
spec:
containers:
- name: agent
image: ampliserv/agent:latest
env:
- name: AMPLISERV_API_KEY
valueFrom:
secretKeyRef:
name: ampliserv-secrets
key: api-key
- name: AMPLISERV_COLLECTOR_MODE
value: "k8s"
volumeMounts:
- name: varlog
mountPath: /var/log
readOnly: true
volumes:
- name: varlog
hostPath:
path: /var/log

Log Format Requirements

The SDK expects JSON logs with the following fields:

{
"timestamp": "2026-03-23T10:30:45.123Z",
"level": "INFO|WARN|ERROR|DEBUG",
"message": "Log message",
"correlation_id": "optional-uuid",
"stack_trace": "optional-stack-trace"
}

Enriched Fields Added by SDK

FieldDescription
agent_idUnique agent identifier
agent_versionSDK version
hostHostname where agent runs
container_idDocker container ID (Docker/K8s mode)
container_nameContainer name (Docker/K8s mode)
pod_nameKubernetes pod name (K8s mode)
namespaceKubernetes namespace (K8s mode)
node_nameKubernetes node name (K8s mode)

Incident Detection Configuration

Default Rules

RuleTriggerSeverityCooldown
Panic Detectionpanic:, fatal error:CRITICAL1 minute
Error Spike10 errors in 1 minuteHIGH1 minute

Custom Rules (Coming Soon)

incident_rules:
- name: "High Error Rate"
pattern: "ERROR"
threshold: 20
window_seconds: 60
severity: "HIGH"

Performance Tuning

Batch Size vs Memory

Batch SizeMemory UsageNetwork Efficiency
10LowLow
50 (Default)MediumMedium
100HighHigh
500Very HighVery High

Flush Interval vs Latency

IntervalLog LatencyNetwork Calls
1 secondVery LowVery High
5 seconds (Default)LowMedium
30 secondsMediumLow
60 secondsHighVery Low

Troubleshooting Configuration

Enable debug logging:

export AMPLISERV_LOG_LEVEL="debug"

Check configuration:

./ampliserv-agent --version
./ampliserv-agent --help

View agent logs:

# SDK logs appear in the terminal where agent runs
# Check for connection errors or parsing issues