This guide covers configuring the LogFlux Agent system, including the main agent daemon and its various plugins.
Quick Setup
After installing the LogFlux Agent, configure the main agent:
|
|
Main Agent Configuration
The main configuration file is located at /etc/logflux-agent/agent.yaml
and uses YAML format:
|
|
Configuration Fields
Field | Required | Description | Example |
---|---|---|---|
api_key |
Yes | Your LogFlux API key | lf_abcd1234efgh5678ijkl9012mnop3456 |
node |
No | Unique identifier for this agent (defaults to hostname) | production-server-01 |
API Key Format
LogFlux API keys follow a specific format:
- Prefix: All keys start with
lf_
- Format:
lf_
followed by 32 alphanumeric characters - Example:
lf_abcd1234efgh5678ijkl9012mnop3456
You can get your API key from the LogFlux dashboard.
Configuration Priority
The LogFlux Agent and CLI use the following configuration priority (highest to lowest):
- Command line flags: Override all other settings
- Custom config file: Specified with
-config
flag - Main agent config:
/etc/logflux-agent/agent.yaml
- Plugin-specific config:
/etc/logflux-agent/plugins/<plugin>.yaml
- Built-in defaults: Fallback values
Plugin Configuration
Each plugin can have its own configuration file in /etc/logflux-agent/plugins/
:
|
|
CLI Plugin Configuration
Example configuration for the CLI plugin:
|
|
Other Plugin Examples
Syslog Plugin Configuration:
|
|
File Monitoring Plugin Configuration:
|
|
CLI Configuration
For CLI-specific configuration, you can also create a user configuration file:
|
|
This creates a configuration file (location varies by permissions):
- System-wide:
/etc/logflux-agent/cli.yaml
(if run with sudo) - User-specific:
~/.logflux-cli.yaml
(if run as user)
Environment Variables
You can override configuration values using environment variables for the CLI:
|
|
Command line flags take precedence over environment variables.
Security Considerations
API Key Security
- Never commit API keys to version control
- Use environment variables in production
- Rotate API keys periodically
- Store keys securely using your preferred secrets management solution
File Permissions
Secure your configuration files:
|
|
Service User
Run the agent service as a dedicated user:
|
|
Add:
|
|
Validation
Test your configuration:
|
|
Service Management
Manage the LogFlux Agent service:
|
|
Common Issues
Agent Service Not Running
|
|
Invalid API Key
Error: authentication failed: invalid API key
- Verify your API key starts with
lf_
- Check that the key is exactly 32 characters after the prefix
- Ensure no extra spaces or characters in the YAML file
Permission Errors
Error: permission denied accessing /tmp/logflux-agent.sock
- Check file permissions on the socket
- Ensure your user has access to the LogFlux agent
- Try running with appropriate permissions
Socket Connection Errors
Error: connection failed: dial unix /tmp/logflux-agent.sock: connect: no such file or directory
- Ensure the LogFlux Agent service is running
- Check that the socket path in configuration is correct
- Verify the agent is listening on the expected socket
Production Setup
For production deployments:
1. Secure Configuration Management
|
|
Add environment variables:
|
|
2. Multiple Environment Setup
Create environment-specific configurations:
|
|
3. Plugin Management
Enable only required plugins:
|
|
4. Monitoring and Alerting
Set up monitoring for the agent:
|
|