Configuration Examples
Standard configuration patterns and examples for LogFlux components
Configuration Examples
This page provides standardized configuration examples and patterns used across LogFlux components including the Agent, SDKs, and client applications.
Environment Variables
Standard Environment Variables
These environment variables work across all LogFlux components:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# Authentication
export LOGFLUX_PAT="lf_pat_your_token_here"
export LOGFLUX_PRIVATE_KEY_FILE="~/.logflux/private_key.pem"
# Connection Settings
export LOGFLUX_SERVER_URL="https://api.logflux.io"
export LOGFLUX_TIMEOUT="30s"
# General Settings
export LOGFLUX_NODE="$(hostname)"
export LOGFLUX_TIMEZONE="UTC"
export LOGFLUX_LOG_LEVEL="info"
# Optional Settings
export LOGFLUX_VERBOSE="false"
export LOGFLUX_DRY_RUN="false"
|
Environment-Specific Variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# Development Environment
export LOGFLUX_PAT="lf_pat_dev_token_here"
export LOGFLUX_LOG_LEVEL="debug"
export LOGFLUX_VERBOSE="true"
# Staging Environment
export LOGFLUX_PAT="lf_pat_staging_token_here"
export LOGFLUX_NODE="staging-$(hostname)"
export LOGFLUX_LOG_LEVEL="info"
# Production Environment
export LOGFLUX_PAT="lf_pat_prod_token_here"
export LOGFLUX_NODE="prod-$(hostname)"
export LOGFLUX_LOG_LEVEL="warn"
export LOGFLUX_TIMEOUT="60s"
|
Agent Configuration
Basic Agent Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# /etc/logflux-agent/agent.yaml
api_key: ${LOGFLUX_PAT}
server_url: https://api.logflux.io
node: ${LOGFLUX_NODE:-default-node}
log_level: ${LOGFLUX_LOG_LEVEL:-info}
# Connection settings
timeout: 30s
retry_attempts: 3
retry_delay: 5s
# Performance settings
batch_size: 100
flush_interval: 5s
buffer_size: 10000
|
Plugin-Specific Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# /etc/logflux-agent/plugins/filestream.yaml
# File monitoring configuration
server_url: /tmp/logflux-agent.sock
api_key: ${LOGFLUX_PAT}
node: ${LOGFLUX_NODE}-filestream
# File monitoring settings
watch_files:
- path: /var/log/apache2/*.log
pattern: "*.log"
recursive: true
# Filtering settings
filters:
- type: level
min_level: info
- type: regex
pattern: "IGNORE"
action: exclude
|
SDK Configuration
Go SDK Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Basic configuration
config := &logflux.Config{
APIKey: os.Getenv("LOGFLUX_PAT"),
ServerURL: os.Getenv("LOGFLUX_SERVER_URL"),
Node: os.Getenv("LOGFLUX_NODE"),
Timeout: 30 * time.Second,
RetryAttempts: 3,
RetryDelay: 5 * time.Second,
}
// Advanced configuration
config := &logflux.Config{
APIKey: os.Getenv("LOGFLUX_PAT"),
ServerURL: "/tmp/logflux-agent.sock", // Unix socket
Node: hostname,
// Batching settings
BatchSize: 100,
FlushInterval: 5 * time.Second,
// Performance settings
BufferSize: 10000,
MaxRetries: 3,
BackoffFactor: 2.0,
}
|
JavaScript SDK Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Basic configuration
const config = {
apiKey: process.env.LOGFLUX_PAT,
serverUrl: process.env.LOGFLUX_SERVER_URL || 'https://api.logflux.io',
node: process.env.LOGFLUX_NODE || 'default-node',
timeout: 30000,
retryAttempts: 3,
retryDelay: 5000
};
// Advanced configuration
const config = {
apiKey: process.env.LOGFLUX_PAT,
serverUrl: '/tmp/logflux-agent.sock', // Unix socket
node: process.env.LOGFLUX_NODE,
// Batching settings
batchSize: 100,
flushInterval: 5000,
// Performance settings
bufferSize: 10000,
maxRetries: 3,
backoffFactor: 2.0,
// Security settings
validateCerts: true,
timeout: 30000
};
|
Python SDK Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# Basic configuration
import os
import logflux
config = logflux.Config(
api_key=os.getenv('LOGFLUX_PAT'),
server_url=os.getenv('LOGFLUX_SERVER_URL', 'https://api.logflux.io'),
node=os.getenv('LOGFLUX_NODE', 'default-node'),
timeout=30.0,
retry_attempts=3,
retry_delay=5.0
)
# Advanced configuration
config = logflux.Config(
api_key=os.getenv('LOGFLUX_PAT'),
server_url='/tmp/logflux-agent.sock', # Unix socket
node=os.getenv('LOGFLUX_NODE'),
# Batching settings
batch_size=100,
flush_interval=5.0,
# Performance settings
buffer_size=10000,
max_retries=3,
backoff_factor=2.0
)
# Batch configuration
batch_config = logflux.BatchConfig(
max_batch_size=50,
flush_interval=2.0,
auto_flush=True
)
|
Java SDK Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Basic configuration
LogFluxConfig config = LogFluxConfig.builder()
.apiKey(System.getenv("LOGFLUX_PAT"))
.serverUrl(System.getenv("LOGFLUX_SERVER_URL"))
.node(System.getenv("LOGFLUX_NODE"))
.timeout(Duration.ofSeconds(30))
.retryAttempts(3)
.retryDelay(Duration.ofSeconds(5))
.build();
// Advanced configuration
LogFluxConfig config = LogFluxConfig.builder()
.apiKey(System.getenv("LOGFLUX_PAT"))
.serverUrl("/tmp/logflux-agent.sock") // Unix socket
.node(System.getenv("LOGFLUX_NODE"))
// Batching settings
.batchSize(100)
.flushInterval(Duration.ofSeconds(5))
// Performance settings
.bufferSize(10000)
.maxRetries(3)
.backoffFactor(2.0)
.build();
|
Client Configuration
CLI Inspector Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# ~/.logflux-inspector.yaml
auth:
token: ${LOGFLUX_PAT}
encryption:
private_key_file: ${LOGFLUX_PRIVATE_KEY_FILE}
connection:
server_url: https://api.logflux.io
timeout: 60s
retry_attempts: 3
defaults:
format: table
limit: 100
timezone: ${LOGFLUX_TIMEZONE:-local}
cache:
enabled: true
ttl: 300s
|
GUI Inspector Configuration
The GUI Inspector stores configuration in application-specific locations:
macOS: ~/Library/Application Support/LogFlux Inspector/config.json
Windows: %APPDATA%\LogFlux Inspector\config.json
Linux: ~/.config/logflux-inspector/config.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
{
"auth": {
"token": "lf_pat_your_token_here",
"method": "pat"
},
"encryption": {
"privateKeyFile": "/Users/username/.logflux/private_key.pem"
},
"connection": {
"serverUrl": "https://api.logflux.io",
"timeout": 60000,
"retryAttempts": 3
},
"ui": {
"theme": "system",
"fontSize": 14,
"autoRefresh": true,
"refreshInterval": 30
}
}
|
Docker Configuration
Docker Environment File
1
2
3
4
5
|
# docker.env
LOGFLUX_PAT=lf_pat_your_token_here
LOGFLUX_PRIVATE_KEY_FILE=/etc/logflux/private_key.pem
LOGFLUX_NODE=docker-container
LOGFLUX_LOG_LEVEL=info
|
Docker Compose Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# docker-compose.yml
version: '3.8'
services:
logflux-agent:
image: logflux/agent:latest
env_file:
- docker.env
volumes:
- ./config:/etc/logflux-agent
- ./keys:/etc/logflux/keys:ro
- /var/log:/var/log:ro
environment:
- LOGFLUX_NODE=${HOSTNAME:-docker-agent}
restart: unless-stopped
app:
build: .
env_file:
- docker.env
environment:
- LOGFLUX_SERVER_URL=http://logflux-agent:8080
depends_on:
- logflux-agent
|
Kubernetes Configuration
ConfigMap
1
2
3
4
5
6
7
8
9
10
11
12
|
apiVersion: v1
kind: ConfigMap
metadata:
name: logflux-config
data:
agent.yaml: |
api_key: ${LOGFLUX_PAT}
server_url: https://api.logflux.io
node: ${POD_NAME}
log_level: info
batch_size: 100
flush_interval: 5s
|
Secret
1
2
3
4
5
6
7
8
|
apiVersion: v1
kind: Secret
metadata:
name: logflux-credentials
type: Opaque
data:
pat: <base64-encoded-token>
private-key: <base64-encoded-private-key>
|
Deployment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
apiVersion: apps/v1
kind: Deployment
metadata:
name: logflux-agent
spec:
replicas: 1
selector:
matchLabels:
app: logflux-agent
template:
metadata:
labels:
app: logflux-agent
spec:
containers:
- name: agent
image: logflux/agent:latest
env:
- name: LOGFLUX_PAT
valueFrom:
secretKeyRef:
name: logflux-credentials
key: pat
- name: LOGFLUX_PRIVATE_KEY_FILE
value: /etc/logflux/private_key.pem
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: config
mountPath: /etc/logflux-agent
- name: credentials
mountPath: /etc/logflux
readOnly: true
volumes:
- name: config
configMap:
name: logflux-config
- name: credentials
secret:
secretName: logflux-credentials
defaultMode: 0600
|
Proxy Configuration
HTTP/HTTPS Proxy
1
2
3
4
5
6
7
8
9
10
|
# Environment variables for proxy support
export HTTPS_PROXY="https://proxy.company.com:8080"
export HTTP_PROXY="http://proxy.company.com:8080"
export NO_PROXY="localhost,127.0.0.1,.local,.company.com"
# Proxy with authentication
export HTTPS_PROXY="https://username:password@proxy.company.com:8080"
# SOCKS proxy
export HTTPS_PROXY="socks5://proxy.company.com:1080"
|
Agent Proxy Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# /etc/logflux-agent/agent.yaml
api_key: ${LOGFLUX_PAT}
server_url: https://api.logflux.io
# Proxy settings
proxy:
enabled: true
url: ${HTTPS_PROXY}
username: ${PROXY_USERNAME}
password: ${PROXY_PASSWORD}
no_proxy:
- localhost
- 127.0.0.1
- .local
|
Integration-Specific Configuration
Syslog Integration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# Syslog daemon configuration
server_url: /tmp/logflux-agent.sock
api_key: ${LOGFLUX_PAT}
node: ${LOGFLUX_NODE}-syslog
# Syslog server settings
listen_address: 0.0.0.0
listen_port: 514
protocol: udp
# Message parsing
parser: rfc3164
facility_mapping: true
severity_mapping: true
|
File Monitoring Integration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File stream configuration
server_url: /tmp/logflux-agent.sock
api_key: ${LOGFLUX_PAT}
node: ${LOGFLUX_NODE}-filestream
# File monitoring
watch_files:
- path: /var/log/apache2/access.log
parser: apache_common
multiline: false
- path: /var/log/application/*.log
parser: json
multiline: true
multiline_pattern: '^\d{4}-\d{2}-\d{2}'
# Performance settings
poll_interval: 1s
batch_size: 1000
max_line_length: 65536
|
Validation and Testing
Configuration Validation
1
2
3
4
5
6
7
8
9
10
11
|
# Validate agent configuration
logflux-agent -config /etc/logflux-agent/agent.yaml -validate
# Validate CLI configuration
logflux-inspector config validate
# Test connection
logflux-inspector auth status --verbose
# Test log transmission
logflux-agent -config /path/to/config.yaml -test
|
Environment Testing
1
2
3
4
5
6
7
8
9
10
|
# Test environment variables
echo "PAT: ${LOGFLUX_PAT:0:8}..."
echo "Node: ${LOGFLUX_NODE}"
echo "Private Key: ${LOGFLUX_PRIVATE_KEY_FILE}"
# Test connectivity
curl -I https://api.logflux.io/health
# Test proxy configuration
curl -I --proxy ${HTTPS_PROXY} https://api.logflux.io/health
|
Configuration Templates
Development Template
1
2
3
4
5
6
7
8
9
|
#!/bin/bash
# Development environment setup
export LOGFLUX_PAT="lf_pat_dev_token_here"
export LOGFLUX_PRIVATE_KEY_FILE="$HOME/.logflux/dev-private-key.pem"
export LOGFLUX_NODE="dev-$(hostname)"
export LOGFLUX_LOG_LEVEL="debug"
export LOGFLUX_VERBOSE="true"
export LOGFLUX_DRY_RUN="false"
|
Production Template
1
2
3
4
5
6
7
8
9
|
#!/bin/bash
# Production environment setup
export LOGFLUX_PAT="lf_pat_prod_token_here"
export LOGFLUX_PRIVATE_KEY_FILE="/etc/logflux/private_key.pem"
export LOGFLUX_NODE="prod-$(hostname)"
export LOGFLUX_LOG_LEVEL="warn"
export LOGFLUX_TIMEOUT="60s"
export LOGFLUX_VERBOSE="false"
|