Syslog Filter Skill
B7.0This skill filters syslog and log files by removing lines containing unwanted phrases, making log analysis cleaner and more focused.
Get This Skill on GitHubOverview
name: syslog-filter description: Filters and cleans syslog/log files by removing unwanted lines containing specific phrases or patterns. Use when the user asks to "regular log file", "filter the log file", "clean the log", "remove noise from logs", or when analyzing logs that need preprocessing to remove unwanted entries. Automatically creates a filtered temporary file for cleaner analysis.
Syslog Filter Skill
This skill filters syslog and log files by removing lines containing unwanted phrases, making log analysis cleaner and more focused.
When This Skill Activates
This skill should be used when:
- User mentions "regular log file"
- User asks to "filter the log file" or "clean the log"
- User wants to "remove noise" or "filter out" specific content from logs
- Analyzing logs that contain repetitive or unwanted entries
Workflow
When filtering a log file:
-
Identify filter criteria: Determine which phrases should be removed. Common patterns include:
- Usernames or user paths (e.g., "alex", "Alex", "/alfeng")
- Separator lines (e.g., "========", "-------")
- Verbose messages (e.g., "Process use", "DEBUG")
- Other noise patterns specific to the log
-
Run the filter script: Use
scripts/filter_syslog.pyto create a cleaned version:python scripts/filter_syslog.py <input_log> <output_log> "phrase1" "phrase2" ... -
Create temporary filtered file: Save the filtered output to a temporary location for analysis:
python scripts/filter_syslog.py input.log /tmp/filtered_log.txt "alex" "Alex" "=======" "Process use" -
Proceed with analysis: Use the filtered file for subsequent analysis, searching, or processing
Filter Script Usage
The filtering script (scripts/filter_syslog.py) removes lines containing specified phrases (case-sensitive).
Syntax:
python filter_syslog.py <input_file> <output_file> [phrase1] [phrase2] ...
Parameters:
input_file: Path to the original log fileoutput_file: Path where filtered log will be savedphrase1, phrase2, ...: List of phrases to filter out (case-sensitive)
Examples:
Remove common noise patterns:
python filter_syslog.py system.log /tmp/clean.log "========" "DEBUG" "Process use"
Remove user-specific paths:
python filter_syslog.py app.log /tmp/app_clean.log "/alfeng" "alex" "Alex"
Multiple filters:
python filter_syslog.py syslog.txt /tmp/filtered.txt "=======" "alex" "Process use" "DEBUG"
Important Notes
- Case-sensitive: Filtering is case-sensitive. "alex" and "Alex" are different and must be specified separately if both should be removed
- Partial matching: Any line containing the phrase will be removed (not just exact matches)
- Temporary files: Use
/tmp/directory for temporary filtered files to avoid cluttering the workspace - Preserve original: The original log file is never modified; filtered output is written to a new file
- Summary output: The script reports how many lines were read, kept, and removed
Default Filters
If no phrases are specified, the script uses these default filters:
- "========"
- "alex"
- "Alex"
- "Process use"
Users can override these by providing explicit phrase arguments.
What This Skill Can Do
AI-generated examples showing real capabilities
Ready to use this skill?
Visit the original repository to get the full skill configuration and installation instructions.
View on GitHub