LogFix Documentation

Complete guide to use LogFix AI-powered error remediation - Web interface, CLI, API, and Auto-PR/MR workflow

Getting Started

Two ways to use LogFix: Web interface (easiest) or CLI (for CI/CD integration)

🌐 Option 1: Web Interface (Recommended)

The fastest way to get started. No installation required!

  1. Sign in with GitHub or GitLab
  2. Choose your plan (Starter €19 or Pro €29/month)
  3. Go to Analysis page
  4. Paste your error log and click "Analyze Log"
  5. Get AI-powered fixes and create Pull Requests automatically!

⚡ Option 2: CLI (For CI/CD)

1. Installation

npm install -g logfix

2. Authentication

Get your API key from the dashboard and authenticate:

logfix auth lf_sk_your_api_key_here

3. Analyze Your First Log

logfix analyze --file error.log --type ci_build --stack node

Authentication

API Keys

All API requests require authentication using an API key. Your API key identifies you and grants access to your account.

Never share your API key publicly or commit it to version control.

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_here

Creating API Keys

  1. Sign in to your Logfix account
  2. Navigate to Dashboard → API Keys
  3. Click "Create API Key"
  4. Give your key a descriptive name (e.g., "CI Production")
  5. Copy the key immediately - you won't be able to see it again!

Context Files

Boost accuracy from 60% to 85%+ by providing relevant files (package.json, source code, configs)

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)

  1. Go to Analysis page
  2. Click "📁 Context Files (Optional)"
  3. Choose "Upload Files" or "From Repository"
  4. Select relevant files (see recommendations below)
  5. 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

  • Dockerfile
  • tsconfig.json
  • .github/workflows/*.yml
  • .gitlab-ci.yml
  • webpack.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:

.js.ts.jsx.tsx.py.java.go.rs.php.rb.json.yml.yaml.toml.ini.conf.md.txt
Security: Never upload .env files or files containing secrets. Use .env.example instead.

API Endpoints

POST/api/v1/analyze

Analyze 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

Auto-PR/MR: Create Pull Requests (GitHub) or Merge Requests (GitLab) automatically from the dashboard!

🚀 Quick Setup (User)

As a user, setup is super simple - no OAuth app creation needed:

  1. Go to Dashboard → API Keys
  2. In the "Auto-PR Creation" section, click "Connect GitHub" or "Connect GitLab"
  3. Authorize LogFix to access your repositories
  4. You're ready! The badge will show "Connected" ✅

⚙️ Admin Setup (Self-Hosted)

For self-hosted instances, admins need to configure OAuth apps:

Click to expand OAuth setup instructions
  1. Create OAuth App:
  2. Configure Callback URL:
    • GitHub: https://yourdomain.com/api/auth/github/callback
    • GitLab: https://yourdomain.com/api/auth/gitlab/callback
  3. Add to .env.local:
    GITHUB_CLIENT_ID=your_client_id
    GITHUB_CLIENT_SECRET=your_client_secret
    GITLAB_CLIENT_ID=your_client_id
    GITLAB_CLIENT_SECRET=your_client_secret

📋 How It Works (Dashboard)

  1. Analyze a log in Analysis page
    • Paste your error log
    • Optionally add Context Files for better accuracy
    • Select log type and stack
  2. AI generates remediation with strategy create_pr
    • The "🔧 Remediation" section appears
    • Shows code preview and PR details
  3. Review and customize
    • Edit PR title and branch name if needed
    • Review the files that will be modified
  4. Enter repository details
    • GitHub: owner/repo (e.g., "johndoe/my-app")
    • GitLab: project ID (e.g., "namespace/project" or numeric ID)
  5. 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
Security: OAuth tokens are stored securely in the database with Row Level Security. Only you can access your integrations.

🖥️ 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 node

GitHub 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.

auto
Auto-detect
node
Node.js/JS
python
Python
java
Java/Kotlin
go
Go
rust
Rust
php
PHP
ruby
Ruby
dotnet
.NET/C#
flutter
Flutter/Dart
react_native
React Native
ios
iOS/Swift
android
Android

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 success field 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:

AuthenticationRate LimitUsage
API Keys (CLI)100 requests/minuteCI/CD pipelines, automated analysis
Session (Web)60 requests/minuteDashboard 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

✅ No credit card required✅ GitHub & GitLab integration✅ CLI for CI/CD✅ Context Files support