| name | log-analysis |
| description | This skill should be used when analyzing Breenix kernel logs for debugging, testing verification, or understanding kernel behavior. Use for searching timestamped logs, finding checkpoint signals, tracing execution flow, identifying errors or panics, and extracting diagnostic information. |
Kernel Log Analysis for Breenix
Search, analyze, and extract information from Breenix kernel logs for debugging and testing.
Purpose
Breenix logs all kernel runs to logs/breenix_YYYYMMDD_HHMMSS.log. This skill provides patterns for searching these logs efficiently, finding checkpoint signals, tracing execution, and diagnosing issues.
When to Use
- Finding test signals: Locate checkpoint markers like
🎯 KERNEL_POST_TESTS_COMPLETE 🎯
- Tracing execution: Follow kernel boot sequence or specific subsystem initialization
- Debugging failures: Find panics, faults, or error messages
- Verifying behavior: Confirm expected operations occurred
- Performance analysis: Check timing of operations via log timestamps
Log Location and Format
logs/breenix_YYYYMMDD_HHMMSS.log
ls -t logs/*.log | head -1 | xargs less
less logs/breenix_20250120_143022.log
Log Format
[ INFO] kernel::memory: Physical memory: 94 MiB usable
[DEBUG] kernel::memory: Frame allocator initialized
[ WARN] kernel::process: No processes ready
Levels: TRACE, DEBUG, INFO, WARN, ERROR
Search Using find-in-logs Script
The scripts/find-in-logs tool searches recent logs:
echo '-A50 "Creating user process"' > /tmp/log-query.txt
./scripts/find-in-logs
Common Search Patterns
echo '-i "panic"' > /tmp/log-query.txt
./scripts/find-in-logs
echo '-i "page fault"' > /tmp/log-query.txt
./scripts/find-in-logs
echo '-A20 -B10 "KERNEL_POST_TESTS_COMPLETE"' > /tmp/log-query.txt
./scripts/find-in-logs
echo '"Creating user process"' > /tmp/log-query.txt
./scripts/find-in-logs
Direct grep Usage
grep -n "ERROR" logs/breenix_20250120_*.log
grep -A10 -B5 "Double Fault" logs/breenix_20250120_*.log
grep -i "memory" logs/breenix_20250120_*.log
grep -E "panic|fault|error" logs/breenix_20250120_*.log
grep -c "Timer interrupt" logs/breenix_20250120_*.log
Common Checkpoint Signals
grep "🎯 KERNEL_POST_TESTS_COMPLETE 🎯" logs/*.log
grep "USERSPACE OUTPUT:" logs/*.log
grep "Hello from userspace" logs/*.log
grep "🎉 USERSPACE SYSCALL" logs/*.log
grep "initialized\|INITIALIZED" logs/*.log
grep "Process created: PID" logs/*.log
Execution Flow Tracing
Boot Sequence
grep -E "Boot|GDT|IDT|PIC|Memory|Heap|Timer|Keyboard" logs/latest.log
grep "memory\|page table\|frame allocator" logs/latest.log
grep "process\|fork\|exec\|PID" logs/latest.log
Subsystem Analysis
grep -n "timer\|RTC\|tick" logs/latest.log
grep -n "interrupt\|IRQ\|IDT" logs/latest.log
grep -n "syscall\|sys_\|INT 0x80" logs/latest.log
Error and Fault Analysis
Finding Faults
grep -A20 "DOUBLE FAULT" logs/*.log
grep -A10 "PAGE FAULT" logs/*.log
grep -B10 -A20 "PANIC" logs/*.log
Error Context
grep -A15 -B5 "ERROR" logs/latest.log
grep -A5 "WARN" logs/latest.log
Log Analysis Patterns
Timeline Analysis
grep -E "\[(INFO|WARN|ERROR|DEBUG)\]" logs/latest.log | less
grep "\[.*\] kernel::process:" logs/latest.log
Success/Failure Detection
if grep -q "KERNEL_POST_TESTS_COMPLETE" logs/latest.log; then
echo "Test completed"
else
echo "Test did not complete"
grep "SUCCESS\|initialized\|completed" logs/latest.log | tail -10
fi
Performance Markers
grep -E "took|elapsed|ms|seconds" logs/latest.log
grep "Context switch\|schedule\|preempt" logs/latest.log
Integration with Other Skills
With kernel-debug-loop
kernel-debug-loop/scripts/quick_debug.py --signal "TARGET_CHECKPOINT"
grep "TARGET_CHECKPOINT" logs/latest.log
With ci-failure-analysis
ci-failure-analysis/scripts/analyze_ci_failure.py target/xtask_*_output.txt
grep "PATTERN" target/xtask_*_output.txt
Best Practices
- Use specific patterns: Narrow searches to relevant subsystems
- Add context: Use
-A (after) and -B (before) flags
- Check latest first:
ls -t logs/*.log | head -1
- Save search queries: Use
/tmp/log-query.txt for complex patterns
- Look for first error: Often followed by cascading failures
- Check initialization: Ensure subsystems initialized before use
- Verify checkpoints: Confirm expected signals appear
Summary
Effective log analysis requires:
- Knowing checkpoint signals
- Using grep with context flags
- Understanding log levels and formats
- Tracing execution flow
- Finding first failures
- Verifying expected behavior
Logs are the primary window into kernel behavior - use them liberally during development and debugging.