LogFix Documentation
Complete guide to use LogFix AI-powered error remediation - Web interface, CLI, API, and Auto-PR/MR workflow
Getting Started
🌐 Option 1: Web Interface (Recommended)
The fastest way to get started. No installation required!
⚡ Option 2: CLI (For CI/CD)
1. Installation
npm install -g logfix2. Authentication
Get your API key from the dashboard and authenticate:
logfix auth lf_sk_your_api_key_here3. Analyze Your First Log
logfix analyze --file error.log --type ci_build --stack nodeAuthentication
API Keys
All API requests require authentication using an API key. Your API key identifies you and grants access to your account.
API keys follow the format: lf_sk_ followed by 48 hexadecimal characters.
Using API Keys in Requests
Include your API key in the Authorization header of every request:
Authorization: Bearer lf_sk_your_api_key_hereCreating API Keys
- Sign in to your Logfix account
- Navigate to Dashboard → API Keys
- Click "Create API Key"
- Give your key a descriptive name (e.g., "CI Production")
- Copy the key immediately - you won't be able to see it again!
Context Files
What are Context Files?
Context Files are additional files you provide to help the AI understand your project structure and generate more accurate fixes. This dramatically improves the quality of Pull Requests and reduces false positives.
How to Use (Web Interface)
- Go to Analysis page
- Click "📁 Context Files (Optional)"
- Choose "Upload Files" or "From Repository"
- Select relevant files (see recommendations below)
- Proceed with your log analysis
Recommended Files
📦 Configuration Files
package.json(Node.js)requirements.txt(Python)Cargo.toml(Rust)go.mod(Go)composer.json(PHP)
🔧 Build & CI Files
Dockerfiletsconfig.json.github/workflows/*.yml.gitlab-ci.ymlwebpack.config.js
Example: Before vs After
❌ Without Context
Log: "Cannot find module 'express'"
AI Response: "Run npm install express"
Result: Simple command (60% accuracy)
✅ With package.json
Log: "Cannot find module 'express'"
AI Response: "Express missing from dependencies"
Result: PR that adds express to package.json (85%+ accuracy)
Supported Formats
Upload up to 10 files, 1MB max per file:
API Endpoints
/api/v1/analyzeAnalyze Logs
Analyze error logs and get AI-powered fixes. This is the main endpoint for log analysis.
Example request:
curl -X POST https://api.logfix.dev/api/v1/analyze \ -H "Authorization: Bearer lf_sk_your_api_key" \ -H "Content-Type: application/json" \ -d '{"logContent": "Error: Cannot find module 'express'"}'Request & Response
Request Body
The request body must be a JSON object with the following fields:
{
"logContent": "string (required, min 10 chars)",
"logType": "ci_build | runtime | client | container | server | database | iac (optional)",
"stack": "auto | node | python | java | go | rust | php | ruby | dotnet | flutter | react_native | ios | android (optional)",
"contextFiles": [
{
"path": "package.json",
"content": "{ \"name\": \"app\", \"dependencies\": {...} }"
}
] (optional),
"errorFileContent": "string (optional)",
"language": "javascript | typescript | python | java | go | rust | php | ruby | csharp (optional)",
"additionalContext": "string (optional)"
}logContent (required): The error log content to analyze. Minimum 10 characters.
logType (optional): Type of log - ci_build, runtime, client, container, server, database, iac.
stack (optional): Tech stack. Use "auto" for automatic detection.
contextFiles (optional): Array of relevant files to improve accuracy (package.json, configs, etc.)
errorFileContent (optional): Content of the file where the error occurred.
language (optional): Programming language for syntax highlighting.
additionalContext (optional): Extra context about the environment or setup.
Success Response (200)
A successful response contains the analysis and fix:
{
"success": true,
"analysis": {
"severity": "critical",
"summary": "Missing dependency in package.json",
"root_cause": "Express module imported but not installed",
"confidence_score": 95
},
"summary": "Missing Express.js dependency",
"explanation": "The error occurs because 'express' is imported but not in package.json",
"fix": "Add express to dependencies and run npm install",
"remediation": {
"strategy": "create_pr",
"prData": {
"title": "fix(deps): add missing express dependency",
"body": "This PR adds the missing express dependency to package.json",
"branchName": "logfix/add-express-dependency",
"targetRepo": "owner/repo",
"files": [
{
"path": "package.json",
"content": "{ \"name\": \"app\", \"dependencies\": { \"express\": \"^4.18.0\" } }"
}
]
}
},
"patch": {
"file_path": "package.json",
"action": "overwrite",
"content": "{ \"name\": \"app\", \"dependencies\": { \"express\": \"^4.18.0\" } }"
},
"creditsUsed": 1,
"creditsRemaining": 49
}success: Always true for successful requests
analysis: Structured analysis with severity, summary, root cause, and confidence score
summary: Brief description of the issue
explanation: Detailed explanation of the error
fix: Human-readable solution description
remediation: Structured remediation with strategy (create_pr, run_command, manual_instruction)
patch: Legacy format - the corrected code that can be applied
creditsUsed: Number of credits consumed (always 1)
creditsRemaining: Your remaining credit balance
Error Responses
401 Unauthorized
Invalid or missing API key
{
"success": false,
"error": "Invalid API key"
}402 Payment Required
Insufficient credits
{
"success": false,
"error": "Insufficient credits"
}400 Bad Request
Invalid request data
{
"success": false,
"error": "Invalid request data",
"details": {
"logContent": ["Log content must be at least 10 characters"]
}
}Auto-PR Workflow
🚀 Quick Setup (User)
As a user, setup is super simple - no OAuth app creation needed:
- Go to Dashboard → API Keys
- In the "Auto-PR Creation" section, click "Connect GitHub" or "Connect GitLab"
- Authorize LogFix to access your repositories
- You're ready! The badge will show "Connected" ✅
⚙️ Admin Setup (Self-Hosted)
For self-hosted instances, admins need to configure OAuth apps:
- Create OAuth App:
- GitHub: Settings → Developer settings → OAuth Apps
- GitLab: Profile → Applications
- Configure Callback URL:
- GitHub:
https://yourdomain.com/api/auth/github/callback - GitLab:
https://yourdomain.com/api/auth/gitlab/callback
- GitHub:
- Add to .env.local:
GITHUB_CLIENT_ID=your_client_idGITHUB_CLIENT_SECRET=your_client_secretGITLAB_CLIENT_ID=your_client_idGITLAB_CLIENT_SECRET=your_client_secret
📋 How It Works (Dashboard)
- Analyze a log in Analysis page
- Paste your error log
- Optionally add Context Files for better accuracy
- Select log type and stack
- AI generates remediation with strategy
create_pr- The "🔧 Remediation" section appears
- Shows code preview and PR details
- Review and customize
- Edit PR title and branch name if needed
- Review the files that will be modified
- Enter repository details
- GitHub: owner/repo (e.g., "johndoe/my-app")
- GitLab: project ID (e.g., "namespace/project" or numeric ID)
- Create PR/MR
- Click "Create Pull Request" or "Create Merge Request"
- LogFix creates branch, commits files, opens PR/MR
- ✅ Success! Link opens to the PR/MR on GitHub/GitLab
🖥️ CLI Usage (CI/CD Integration)
Use the CLI in your CI/CD pipelines to analyze build failures automatically:
Basic Usage
logfix analyze --file error.log --type ci_build --stack nodeGitHub Actions Example
- name: Analyze build errors
if: failure()
run: |
npm install -g logfix
logfix auth ${{ secrets.LOGFIX_API_KEY }}
logfix analyze --file build.log --type ci_build --stack node💡 Tip: The CLI shows the analysis and remediation. For PR creation, use the dashboard for better security and UX.
🔗 Supported Providers
GitHub
- ✅ GitHub.com (public & private repos)
- ✅ GitHub Enterprise (coming soon)
- 🔐 OAuth scope:
repo - ⚡ Multi-step Git operations via Octokit
GitLab
- ✅ GitLab.com (SaaS)
- ✅ Self-hosted instances
- 🔐 OAuth scopes:
api,read_user - ⚡ One-shot commit API (faster than GitHub)
💡 Auto-detection: LogFix automatically detects the provider from your repository URL
Log Types & Stacks
Log Types
Specify the log type to help the AI understand the context and generate better solutions:
🏗️ ci_build
Build, compilation, packaging errors
Examples: npm build, webpack, docker build
⚡ runtime
Application execution errors
Examples: TypeError, ModuleNotFoundError
🌐 client
Browser, mobile app errors
Examples: JavaScript errors, React warnings
🐳 container
Docker, Kubernetes errors
Examples: ImagePullBackOff, container crashes
🖥️ server
Server, API, service errors
Examples: Express errors, nginx issues
🗄️ database
Database, migration errors
Examples: SQL errors, connection issues
☁️ iac
Infrastructure as Code
Examples: Terraform, CloudFormation
Tech Stacks
Specify your tech stack for more accurate code suggestions. Use "auto" for automatic detection.
Remediation Strategies
Based on the log type and context, the AI chooses the best remediation strategy:
🔧 create_pr
Creates a Pull/Merge Request with code fixes
When: Code changes, config updates, new files needed
⚡ run_command
Provides a shell command to execute
When: Simple fixes like npm install, docker pull
📋 manual_instruction
Provides step-by-step manual instructions
When: Environment setup, permissions, external services
Error Handling
Best practices for handling API responses:
- Always check the
successfield before processing results - Handle 401 errors by verifying your API key is correct
- Handle 402 errors by purchasing credits or upgrading your plan
- Handle 400 errors by validating your request data
- Retry on 5xx errors with exponential backoff (wait 1s, 2s, 4s, etc.)
- Log all errors for debugging purposes
Example Error Handling
try {
const response = await fetch('https://api.logfix.dev/api/v1/analyze', {
method: 'POST',
headers: {
'Authorization': 'Bearer lf_sk_your_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({ logContent: '...' })
});
const data = await response.json();
if (!response.ok) {
if (response.status === 401) {
throw new Error('Invalid API key');
} else if (response.status === 402) {
throw new Error('Insufficient credits');
} else {
throw new Error(data.error || 'Request failed');
}
}
if (data.success && data.patch) {
// Apply the fix
applyPatch(data.patch);
}
} catch (error) {
console.error('Logfix API error:', error);
}Rate Limits & Credits
Credits System
Each log analysis consumes 1 credit. Credits are consumed based on your plan:
- Starter Plan: Uses credit balance (purchase credits as needed)
- Pro Plan: Uses monthly allowance first, then credit balance if exceeded
Rate Limits
Rate limits prevent abuse and ensure fair usage:
| Authentication | Rate Limit | Usage |
|---|---|---|
| API Keys (CLI) | 100 requests/minute | CI/CD pipelines, automated analysis |
| Session (Web) | 60 requests/minute | Dashboard usage, manual analysis |
If you exceed the rate limit, you'll receive a 429 Too Many Requests error. Wait before retrying.
🚀 Ready to Fix Errors with AI?
Join developers using LogFix to analyze logs, generate fixes, and create Pull Requests automatically