Files
logpile/internal/parser/vendors/template/parser.go.template
Michael Chus 512957545a Add LOGPile BMC diagnostic log analyzer
Features:
- Modular parser architecture for vendor-specific formats
- Inspur/Kaytus parser supporting asset.json, devicefrusdr.log,
  component.log, idl.log, and syslog files
- PCI Vendor/Device ID lookup for hardware identification
- Web interface with tabs: Events, Sensors, Config, Serials, Firmware
- Server specification summary with component grouping
- Export to CSV, JSON, TXT formats
- BMC alarm parsing from IDL logs (memory errors, PSU events, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 04:11:23 +03:00

71 lines
1.6 KiB
Plaintext

// Package VENDORNAME provides parser for VENDOR_DESCRIPTION BMC diagnostic archives
// Copy this template to create a new vendor parser module
package VENDORNAME
import (
"strings"
"git.mchus.pro/mchus/logpile/internal/models"
"git.mchus.pro/mchus/logpile/internal/parser"
)
func init() {
parser.Register(&Parser{})
}
// Parser implements VendorParser for VENDOR_DESCRIPTION servers
type Parser struct{}
// Name returns human-readable parser name
func (p *Parser) Name() string {
return "VENDOR_DESCRIPTION BMC Parser"
}
// Vendor returns vendor identifier
func (p *Parser) Vendor() string {
return "VENDORNAME"
}
// Detect checks if archive matches this vendor's format
// Returns confidence 0-100
func (p *Parser) Detect(files []parser.ExtractedFile) int {
confidence := 0
for _, f := range files {
path := strings.ToLower(f.Path)
// Add detection logic here
// Example:
// if strings.Contains(path, "unique_vendor_file.log") {
// confidence += 50
// }
_ = path
}
// Cap at 100
if confidence > 100 {
return 100
}
return confidence
}
// Parse parses the archive using vendor-specific logic
func (p *Parser) Parse(files []parser.ExtractedFile) (*models.AnalysisResult, error) {
result := &models.AnalysisResult{
Events: make([]models.Event, 0),
FRU: make([]models.FRUInfo, 0),
Sensors: make([]models.SensorReading, 0),
}
// Add parsing logic here
// Example:
// if f := parser.FindFileByName(files, "sensor_data.log"); f != nil {
// result.Sensors = parseSensorLog(f.Content)
// }
return result, nil
}
// Add helper functions for parsing specific file formats below