CLI Inspector
Command-line tool for powerful log analysis and investigation
LogFlux Inspector is a powerful command-line tool for analyzing, searching, and investigating your encrypted logs. It performs all decryption locally on your system, ensuring complete privacy and security.
Overview
LogFlux Inspector provides advanced log analysis capabilities through an intuitive command-line interface:
- Advanced Search: Complex queries with filters, time ranges, and regex support
- Real-time Streaming: Live log monitoring with customizable filtering
- Batch Operations: Bulk log analysis and processing capabilities
- Export Capabilities: Output logs in various formats (JSON, CSV, plain text)
- Automation Ready: Perfect for DevOps workflows and CI/CD integration
Installation
For complete installation instructions, see the Installation Guide.
Quick Start
- Download LogFlux Inspector CLI from the LogFlux dashboard
- Make the binary executable:
chmod +x logflux-inspector
- Optionally move to system PATH:
sudo mv logflux-inspector /usr/local/bin/
- Verify installation:
logflux-inspector --version
Authentication Setup
For complete authentication setup, see the Authentication Guide.
Quick Start
- Get your Personal Access Token from the LogFlux dashboard
- Login:
logflux-inspector auth login --token lf_pat_your_token_here
- Configure your private key:
logflux-inspector config set-key --private-key-file ~/.logflux/private_key.pem
- Verify setup:
logflux-inspector auth status
Basic Usage
List Recent Logs
1
2
3
4
5
6
7
8
|
# Show recent logs (default: last 100)
logflux-inspector logs
# Limit number of logs
logflux-inspector logs --limit 50
# Show logs with specific format
logflux-inspector logs --format json
|
Search Logs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# Search by log level
logflux-inspector search --level error
# Search by time range
logflux-inspector search --since "1h" --until "now"
# Search by node
logflux-inspector search --node production-server-01
# Search by message content
logflux-inspector search --contains "database connection"
# Complex search with multiple filters
logflux-inspector search \
--level error \
--node production \
--contains "timeout" \
--since "2024-01-01" \
--until "2024-01-02"
|
LogFlux Inspector supports flexible time formats:
1
2
3
4
5
6
7
8
9
10
11
|
# Relative times
--since "1h" # 1 hour ago
--since "30m" # 30 minutes ago
--since "7d" # 7 days ago
# Absolute times
--since "2024-01-01"
--since "2024-01-01 14:30:00"
# ISO 8601 format
--since "2024-01-01T14:30:00Z"
|
Advanced Features
Real-time Log Streaming
Monitor logs in real-time:
1
2
3
4
5
6
7
8
|
# Stream all new logs
logflux-inspector stream
# Stream with filters
logflux-inspector stream --level error --node production
# Stream with format
logflux-inspector stream --format json
|
Export and Analysis
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# Export logs to file
logflux-inspector export \
--since "30d" \
--format json \
--output compliance-logs.json
# Export with specific filters
logflux-inspector export \
--level error \
--node production \
--since "2024-01-01" \
--until "2024-01-31" \
--format csv \
--output error-report.csv
# Export specific fields
logflux-inspector export \
--fields timestamp,level,message,node \
--format json
|
Statistical Analysis
1
2
3
4
5
6
7
8
|
# Log level distribution
logflux-inspector stats levels --since "1d"
# Logs per node
logflux-inspector stats nodes --since "7d"
# Timeline analysis
logflux-inspector stats timeline --since "1d" --interval "1h"
|
LogFlux Inspector supports multiple output formats:
1
|
logflux-inspector search --level error --format json
|
1
2
3
4
5
6
7
8
9
10
11
12
|
[
{
"timestamp": "2024-01-20T14:30:45.123Z",
"level": "error",
"message": "Database connection failed",
"node": "production-server-01",
"fields": {
"error": "connection timeout",
"database": "postgresql"
}
}
]
|
1
|
logflux-inspector search --level error --format csv
|
1
|
logflux-inspector search --level error --format table
|
1
2
|
# Raw decrypted log messages only
logflux-inspector search --level error --format raw
|
Configuration
For comprehensive configuration examples and patterns, see Configuration Examples.
Configuration File
Create a configuration file to avoid repeating options:
1
2
|
# Initialize configuration
logflux-inspector config init
|
This creates ~/.logflux-inspector.yaml
:
1
2
3
4
5
6
7
8
9
10
11
|
# LogFlux Inspector Configuration
auth:
token: lf_pat_your_token_here
encryption:
private_key_file: ~/.logflux/private_key.pem
defaults:
format: table
limit: 100
timezone: local
|
Environment Variables
1
2
3
4
|
export LOGFLUX_PAT="lf_pat_your_token_here"
export LOGFLUX_PRIVATE_KEY_FILE="~/.logflux/private_key.pem"
export LOGFLUX_FORMAT="json"
export LOGFLUX_TIMEZONE="UTC"
|
Command Reference
Authentication Commands
1
2
3
4
5
|
logflux-inspector auth login --token <token> # Login with PAT
logflux-inspector auth logout # Logout
logflux-inspector auth status # Check auth status
logflux-inspector auth whoami # Show current user
logflux-inspector auth refresh # Refresh token
|
Log Commands
1
2
3
4
5
|
logflux-inspector logs [options] # List recent logs
logflux-inspector search [options] # Search logs
logflux-inspector stream [options] # Stream real-time logs
logflux-inspector export [options] # Export logs
logflux-inspector stats <type> [options] # Statistical analysis
|
Configuration Commands
1
2
3
4
5
|
logflux-inspector config init # Initialize config
logflux-inspector config set <key> <value> # Set config value
logflux-inspector config get <key> # Get config value
logflux-inspector config list # List all config
logflux-inspector config set-key [options] # Set encryption key
|
Common Options
1
2
3
4
5
6
7
8
9
10
11
12
|
--level <level> # Filter by log level (debug,info,warn,error)
--node <node> # Filter by node name
--since <time> # Start time for logs
--until <time> # End time for logs
--contains <text> # Filter by message content
--format <format> # Output format (table,json,csv,raw)
--limit <number> # Maximum number of logs
--output <file> # Output to file
--fields <list> # Specific fields to include
--timezone <tz> # Timezone for timestamps
--verbose # Verbose output
--quiet # Quiet output
|
Automation and Scripting
Shell Integration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/bin/bash
# Daily error report script
# Export yesterday's errors
logflux-inspector export \
--level error \
--since "1d" \
--format json \
--output "errors-$(date +%Y%m%d).json"
# Email report (example)
if [ -s "errors-$(date +%Y%m%d).json" ]; then
echo "Error report attached" | mail -a "errors-$(date +%Y%m%d).json" -s "Daily Error Report" admin@company.com
fi
|
CI/CD Integration
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
|
# GitHub Actions example
name: Log Analysis
on:
schedule:
- cron: '0 9 * * *' # Daily at 9 AM
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- name: Download LogFlux Inspector
run: |
# Download from your dashboard and store binary in repository
# or use a secure download method with authentication
wget -O logflux-inspector ${{ secrets.LOGFLUX_INSPECTOR_DOWNLOAD_URL }}
chmod +x logflux-inspector
- name: Authenticate
run: ./logflux-inspector auth login --token ${{ secrets.LOGFLUX_PAT }}
- name: Export Error Logs
run: |
./logflux-inspector export \
--level error \
--since "24h" \
--format json \
--output error-report.json
- name: Upload Report
uses: actions/upload-artifact@v3
with:
name: error-report
path: error-report.json
|
Troubleshooting
Authentication Issues
1
2
3
4
5
6
7
8
9
|
# Check authentication status
logflux-inspector auth status
# Re-authenticate
logflux-inspector auth logout
logflux-inspector auth login --token your_new_token
# Verify token format
echo $LOGFLUX_PAT | grep "^lf_pat_"
|
Decryption Issues
1
2
3
4
5
6
7
8
|
# Verify private key
logflux-inspector config get encryption.private_key_file
# Test key access
openssl rsa -in ~/.logflux/private_key.pem -check
# Set key explicitly
logflux-inspector config set-key --private-key-file /path/to/key.pem
|
Network Issues
1
2
3
4
5
6
|
# Test connectivity
logflux-inspector auth status --verbose
# Use proxy if needed
export HTTPS_PROXY=http://proxy.company.com:8080
logflux-inspector logs
|
1
2
3
4
5
6
7
8
|
# Use time ranges to limit data
logflux-inspector search --since "1h" --level error
# Enable local caching
logflux-inspector config set cache.enabled true
# Increase timeout for large queries
logflux-inspector search --timeout 300s
|
Best Practices
For comprehensive security guidelines, see Security Best Practices.
For standard configuration patterns, see Configuration Examples.
CLI-Specific Best Practices
- Time Range Filtering: Always use specific time ranges for better performance
- Level Filtering: Filter by log level to reduce data volume
- Local Caching: Enable caching for frequently accessed logs
- Batch Operations: Use export for large-scale analysis instead of repeated searches
Workflow Integration
- Configuration Files: Use config files to avoid repeating options
- Automation Scripts: Create scripts for common analysis tasks
- Saved Searches: Document frequently used search patterns
Next Steps