The LogFlux API is the primary endpoint for sending log data to LogFlux. It provides a simple, secure REST API for log ingestion with support for standardized syslog-compatible log levels and encrypted payloads.
Base URLs
LogFlux provides customer-specific endpoints to ensure data residency compliance and optimal performance:
Each customer receives a unique subdomain for enhanced security and isolation:
- EU Region:
https://[customer-id].ingest.[region].logflux.io/v1
- US Region:
https://[customer-id].ingest.[region].logflux.io/v1
Example: https://c12345.ingest.us.logflux.io/v1
Benefits of Customer-Specific URLs
- Enhanced Security: Dedicated subdomain for your organization
- Better Isolation: Logical separation from other customers
- Custom Configuration: Tailored rate limits and settings
- Easier Monitoring: Clear identification in logs and metrics
Authentication
All API requests (except health and version endpoints) require authentication using API keys.
API Key Format
|
|
Key Characteristics:
- Prefix: All keys start with
lf_
- Format:
lf_
followed by 32 alphanumeric characters - Example:
lf_abcd1234efgh5678ijkl9012mnop3456
Endpoints
Health Check
Check if the service is running.
|
|
Response:
200 OK
Content-Type: text/plain
OK
Version Information
Get API version and compatibility information.
|
|
Response:
|
|
Handshake - Initialize
Request the server’s RSA public key to begin secure key exchange.
|
|
Request Body:
|
|
Response:
|
|
Handshake - Complete
Send your encrypted AES key to establish secure communication.
|
|
Request Body:
|
|
Response:
|
|
Important: The encrypted_secret
contains your AES-256 key encrypted with RSA-OAEP-SHA256 using the server’s public key.
Ingest Log Entry
Send a log entry to LogFlux after completing the handshake.
|
|
Important: All log entries MUST be encrypted. Complete the handshake before sending logs.
Request Body:
|
|
Request Parameters
Field | Type | Required | Description | Format |
---|---|---|---|---|
timestamp |
string | Yes | Event timestamp | ISO 8601 with timezone |
node |
string | Yes | Source identifier | Max 255 chars |
loglevel |
integer | Yes | Log severity level | 1-8 (see below) |
payload |
string | Yes | Encrypted log data (IV + ciphertext) | Base64 encoded, max 1MB |
key_uuid |
string | Yes | UUID from handshake | UUID v4 format |
Log Levels (Syslog Compatible)
Level | Name | Description |
---|---|---|
1 | EMERGENCY | System is unusable |
2 | ALERT | Action must be taken immediately |
3 | CRITICAL | Critical conditions |
4 | ERROR | Error conditions |
5 | WARNING | Warning conditions |
6 | NOTICE | Normal but significant |
7 | INFO | Informational messages |
8 | DEBUG | Debug-level messages |
Encryption Details
- Algorithm: AES-256-GCM (established via RSA handshake)
- Key Exchange: RSA-OAEP-SHA256 with 4096-bit keys
- Payload Format: Base64(IV[12 bytes] + AES-GCM-encrypted-data)
- Key Management: Session-based with UUID tracking
Success Response:
|
|
Batch Ingestion
Submit multiple log entries in a single request for high-volume logging.
|
|
Request Body:
|
|
Limits: Maximum 100 entries per batch
Error Responses
All errors follow a consistent format:
|
|
Error Codes
Client Errors (4xx)
Code | HTTP Status | Description |
---|---|---|
INVALID_API_KEY |
401 | Invalid or missing API key |
RATE_LIMIT_EXCEEDED |
429 | Too many requests |
INVALID_REQUEST |
400 | Malformed request body |
PAYLOAD_TOO_LARGE |
413 | Payload exceeds size limit |
INVALID_TIMESTAMP |
400 | Timestamp format error |
INVALID_LOG_LEVEL |
400 | Log level out of range (1-8) |
INVALID_ENCRYPTION_MODE |
400 | Unsupported encryption mode |
Server Errors (5xx)
Code | HTTP Status | Description |
---|---|---|
INTERNAL_ERROR |
500 | Internal server error |
SERVICE_UNAVAILABLE |
503 | Service temporarily unavailable |
TIMEOUT |
504 | Request processing timeout |
Rate Limiting
LogFlux implements rate limiting to ensure fair usage:
Limits
Scope | Limit | Window |
---|---|---|
Per API Key | 600 requests | 1 minute |
Per IP Address | 60 requests | 1 minute |
Batch Size | 100 entries | Per request |
Rate Limit Headers
All responses include rate limit information:
|
|
Rate Limit Response
When rate limit is exceeded:
|
|
HTTP Status: 429 Too Many Requests
CORS Support
The API includes full CORS support for browser-based applications:
|
|
Example Usage
SDK Recommendation: While the examples below demonstrate the API, for production use we strongly recommend using our official SDKs which provide:
- Automatic handshake and key management
- Secure AES-256-GCM encryption
- Retry logic with exponential backoff
- Connection pooling and batching
- Built-in error handling
- Graceful degradation
cURL
|
|
Batch Example
|
|
Best Practices
1. Timestamp Handling
- Always include timezone information
- Use UTC timestamps when possible
- Format:
YYYY-MM-DDTHH:mm:ss.sssZ
2. Error Handling
- Implement exponential backoff for retries
- Honor
retry_after
values in rate limit responses - Log failed requests for debugging
3. Batch Processing
- Use batch endpoints for high-volume logging
- Limit batch size to 100 entries
- Include diverse log levels in batches
4. Encryption
- Complete handshake before sending logs
- Cache key_uuid for subsequent requests
- Generate unique IV for each message
- Never send unencrypted payloads
- Re-handshake if key errors occur
5. Performance
- Reuse HTTP connections when possible
- Implement client-side queuing for resilience
- Monitor rate limit headers
Security Considerations
Transport Security
- All communication must use HTTPS
- Minimum TLS version: 1.2
- Certificate validation required
API Key Security
- Never log API keys
- Rotate keys periodically
- Use environment variables for key storage
Payload Security
- All payloads must be encrypted
- Complete RSA handshake to establish AES keys
- Use AES-256-GCM with session keys
- Generate unique IV for each message
- Track key_uuid for proper decryption
API Versioning
LogFlux uses URL path versioning to ensure backward compatibility. The current version is v1
. When new versions are released:
- Existing versions will continue to work
- Deprecation notices will be provided well in advance
- Version information is available via the
/version
endpoint - Breaking changes require new major version