Version: 6.0
Author: MD Faysal Mahmud (faysaliteng@gmail.com)
Repository: https://github.com/Blindsinner/log-ai-analyzer
Enhanced With: Google Gemini, OpenAI, Azure OpenAI, unified offline/online error analysis, multi-format support, and responsive HTML exports.
Another Log Analyzer Web Verison: AI-Powered-Log-Analyzer-Ultimate GUI (WEB)
LogAI Analyzer is a powerful PowerShell tool designed to parse and diagnose errors from Microsoft Intune, Autopilot, and other Windows log sources. It intelligently combines a local error database (error_db.json
) with AI-powered analysis from Google Gemini, OpenAI, and Azure OpenAI to deliver comprehensive diagnostics.
-
Universal File Support: Natively handles
.zip
,.xlsx
,.xls
,.evtx
,.etl
,.log
,.txt
,.html
,.xml
, and more. -
Recursive Archive Extraction: Automatically processes nested archives to find all relevant logs.
-
Hybrid Analysis:
- Offline: Fast lookups using the local
error_db.json
. - Online: AI-driven diagnostics for unrecognized or complex errors.
- Offline: Fast lookups using the local
-
Custom Keyword Detection: Define your own search tokens in the
errorcloud.txt
file. -
Responsive Reports: Generates professional, SEO-friendly HTML and plain-text reports.
-
Cross-Platform: Compatible with Windows PowerShell 5.1+ and PowerShell Core (macOS/Linux).
- Prerequisites
- Installation & Cross-Platform Setup
- Configuration
- File & Folder Structure
- Usage Examples
- Main Menu Options
- Core Logic
- Output
- Troubleshooting
- Contributing & License
-
PowerShell:
- Windows: PowerShell 5.1 or later.
- macOS/Linux: PowerShell Core v7.2+ (
pwsh
).
-
PowerShell Module: The
ImportExcel
module is required for.xlsx
and.xls
file support. -
Permissions: Administrator privileges are required on Windows to analyze
.evtx
and.etl
files. -
Internet Connection: Required for AI-based analysis and optional online searches.
-
Required Files: The
LogAnalyzer.ps1
,error_db.json
, anderrorcloud.txt
files must be located in the same directory.
-
Run as Administrator: Search for βPowerShellβ, right-click it, and select Run as administrator.
-
Verify Git Installation:
git --version
- If Git is not installed, download it from https://git-scm.com/download/win and restart your administrative PowerShell session.
-
Get the Code:
-
With Git (Recommended):
git clone https://github.com/Blindsinner/log-ai-analyzer.git cd log-ai-analyzer
-
Without Git:
-
Navigate to https://github.com/Blindsinner/log-ai-analyzer.
-
Click Code β Download ZIP.
-
Extract the archive to a known location (e.g.,
C:\Users\YourUser\Downloads\log-ai-analyzer
). -
In PowerShell, navigate to the directory:
cd "C:\Users\YourUser\Downloads\log-ai-analyzer"
-
-
-
Install Required Module:
Install-Module -Name ImportExcel -AcceptLicense -Force
-
Unblock the Script:
Unblock-File -Path .\LogAnalyzer.ps1
-
Run the Analyzer:
.\LogAnalyzer.ps1
-
Install PowerShell Core (Example for Ubuntu):
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb sudo apt-get update sudo apt-get install -y powershell
-
Clone Repository & Navigate:
git clone https://github.com/Blindsinner/log-ai-analyzer.git cd log-ai-analyzer
-
Install Required Module:
pwsh -Command "Install-Module -Name ImportExcel -AcceptLicense -Force"
-
Run the Analyzer:
pwsh ./LogAnalyzer.ps1
Note: Analysis of
.evtx
and.etl
files is only supported on Windows. All other formats are fully functional across all platforms.
- API Keys: The first time you use an AI-powered feature, the script will prompt you to enter and save your API keys. The keys will be stored locally in
gemini_key.txt
,openai_key.txt
, andazure_key.txt
. - Offline Database: You can extend the local database by editing
error_db.json
. Add new entries using the format:{ "ErrorCode": "0x12345678", "Message": "A brief description.", "Solution": "A detailed solution." }
. - Custom Keywords: Add your own comma-separated keywords to
errorcloud.txt
(e.g.,timeout,access denied,failed to connect
) to customize error detection.
log-ai-analyzer/
βββ LogAnalyzer.ps1 # Main script
βββ error_db.json # Offline error database
βββ errorcloud.txt # Custom keyword list
βββ gemini_key.txt # Created automatically on first AI run
βββ openai_key.txt # Created automatically on first AI run
βββ azure_key.txt # Created automatically on first AI run
βββ Analyzed Results/ # Default directory for output files
βββ LogAnalysis_YYYYMMDD_HHMMSS.html
βββ AI_Analysis_YYYYMMDD_HHMMSS.txt
.\LogAnalyzer.ps1
# Select option 1 from the menu
# Enter the path to your log file, e.g., C:\Logs\example.evtx
=== Universal Log Analyzer Menu (v6.0 Gemini Enhanced) ===
1. Analyze Log File (Offline DB & optional online search)
2. Analyze with AI Only (Directly analyze log with selected AI)
3. Select AI Model (Current: gemini-pro)
4. Manage AI Providers & API Keys
5. Exit
Choose an option (1-5):
- File Identification: The script first determines the file type based on its extension.
- Extraction & Parsing: Archives are recursively extracted, and Excel files are imported. Event logs (
.evtx
), trace logs (.etl
), and plain-text logs are parsed accordingly. - Pattern Matching: The content is scanned for hexadecimal error codes, error-related phrases, and custom keywords from
errorcloud.txt
. - Hybrid Resolution: Detected errors are first looked up in the local
error_db.json
. If an error is not found, it is sent to the selected AI model for advanced analysis.
- Console: Real-time progress and results are displayed in neatly bordered sections.
- Text Files:
*.txt
files provide a simple summary of findings. - HTML Reports:
*.html
files offer a responsive, card-based layout for easy reading and sharing. - All reports are saved to the
Analyzed Results/
folder with a timestamp for clear organization.
ImportExcel
Module Not Found: Ensure the module is installed by runningInstall-Module ImportExcel -Force
in an administrative PowerShell session.- Permission Denied Errors: The script requires elevated (administrator) privileges to read certain system logs (
.evtx
,.etl
). Right-click PowerShell and select "Run as administrator." - No Errors Detected: Double-check that the file path is correct and that the logs contain searchable error codes or keywords defined in
errorcloud.txt
. - AI Analysis Fails: Verify that your API keys are correct and that you have a stable internet connection. Check the AI provider's status page for any outages.
We welcome contributions! Feel free to open issues, submit pull requests, update the error database, or improve the documentation.
This project is licensed under the MIT License. See the LICENSE
file in the repository for details.