performing-linux-log-forensics-investigation
Helps your agent investigate Linux system logs. It looks for unauthorized access and reconstructs activities to understand what happened.
What it does
This tool examines your Linux system's log files to find clues about what happened. It helps uncover who accessed the system, when, and how, making it useful for investigating suspicious activities or attacks.
When to use it
- ✓When you suspect someone has invaded your Linux server.
- ✓While investigating a security incident and needing to know who did what.
- ✓To review access history and commands executed on the system.
Example of what to ask your AI
“Analyze my Linux server logs to find any unauthorized access in the last 24 hours.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool reads important log files like auth.log and the journal, looking for access patterns, executed commands, and login attempts. It organizes this information so you can understand the sequence of events.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-linux-log-forensics-investigationOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/performing-linux-log-forensics-investigation/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Performing Linux Log Forensics Investigation
Overview
Linux systems maintain extensive logs that serve as primary evidence sources in forensic investigations. Unlike Windows Event Logs, Linux logs are typically plain-text files stored in /var/log/ and binary journal files managed by systemd-journald. Key forensic logs include auth.log (authentication events, sudo usage, SSH sessions), syslog (system-wide messages), kern.log (kernel events), and application-specific logs. The Linux Audit framework (auditd) provides detailed security event logging comparable to Windows Security Event Logs. Forensic analysis of these logs enables investigators to reconstruct user sessions, identify unauthorized access, detect privilege escalation, trace lateral movement, and establish comprehensive event timelines.
When to Use
- When conducting security assessments that involve performing linux log forensics investigation
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Familiarity with digital forensics concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Key Log Files and Locations
| Log File | Path | Contents |
|---|---|---|
| auth.log / secure | /var/log/auth.log (Debian) or /var/log/secure (RHEL) | Authentication, sudo, SSH, PAM |
| syslog / messages | /var/log/syslog (Debian) or /var/log/messages (RHEL) | General system messages |
| kern.log | /var/log/kern.log | Kernel messages, USB events, driver loads |
| lastlog | /var/log/lastlog | Last login per user (binary) |
| wtmp | /var/log/wtmp | Login/logout records (binary, read with last) |
| btmp | /var/log/btmp | Failed login attempts (binary, read with lastb) |
| faillog | /var/log/faillog | Failed login counter (binary) |
| cron.log | /var/log/cron or /var/log/syslog | Scheduled task execution |
| audit.log | /var/log/audit/audit.log | Linux Audit Framework events |
| journal | /var/log/journal/ or /run/log/journal/ | systemd binary journal |
| dpkg.log | /var/log/dpkg.log | Package installation/removal (Debian) |
| yum.log | /var/log/yum.log | Package installation/removal (RHEL) |
Analysis Techniques
Authentication Log Analysis
# Find all successful SSH logins
grep "Accepted" /var/log/auth.log
# Find failed SSH login attempts
grep "Failed password" /var/log/auth.log
# Extract unique source IPs from failed logins
grep "Failed password" /var/log/auth.log | grep -oP '\d+\.\d+\.\d+\.\d+' | sort -u
# Find sudo command execution
grep "sudo:" /var/log/auth.log | grep "COMMAND"
# Detect brute force patterns (>10 failures from same IP)
grep "Failed password" /var/log/auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head -20
# Find account creation events
grep "useradd\|adduser" /var/log/auth.log
# Detect SSH key authentication
grep "Accepted publickey" /var/log/auth.log
Systemd Journal Analysis
# Export journal in JSON format for forensic processing
journalctl --output=json --no-pager > journal_export.json
# Filter by time range
journalctl --since "2025-02-01" --until "2025-02-15" --output=json > timerange.json
# Filter by unit/service
journalctl -u sshd --output=json > sshd_journal.json
# Show kernel messages (USB events, module loads)
journalctl -k --output=json > kernel_journal.json
# Filter by priority (0=emerg to 7=debug)
journalctl -p err --output=json > errors.json
# Boot-specific logs
journalctl -b 0 --output=json > current_boot.json
journalctl --list-boots # List all recorded boot sessions
Linux Audit Framework Analysis
# Search audit log for specific event types
ausearch -m USER_AUTH --start today
# Search for file access events
ausearch -f /etc/shadow
# Search for process execution
ausearch -m EXECVE --start "02/01/2025" --end "02/28/2025"
# Generate report of login events
aureport --login --start "02/01/2025"
# Generate summary of failed authentications
aureport --auth --failed
# Search for specific user activity
ausearch -ua 1001 # By UID
ausearch -ua username # By username
Cron Job Investigation
# Check system-wide crontab
cat /etc/crontab
# Check user crontabs
ls -la /var/spool/cron/crontabs/
# Review cron execution logs
…
FAQ
What types of logs does this tool analyze?
It analyzes authentication logs (auth.log), system messages (syslog), kernel logs (kern.log), audit logs (auditd), and the systemd journal, among others.
What does 'forensics' mean in this context?
Forensics means investigating past events using digital evidence, like system logs, to understand what happened, similar to a police investigation.
Do I need to be a Linux expert to use this?
You don't need to be an expert, but having a basic understanding of how Linux works and what logs are can help in interpreting the results.
Details
Original description by the author
Perform forensic investigation of Linux system logs including syslog, auth.log, systemd journal (via journalctl), kern.log, auditd, and application logs to reconstruct user sessions, identify unauthorized access and privilege escalation, trace lateral movement, and establish event timelines. Use when investigating a suspected compromise of a Linux system and needing to analyze SSH, sudo, cron, or
Popularity
- GitHub stars
- 35k
- Ranking position
- #6094
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
data-throughput-accelerator
Makes your agent speed up the movement of large data volumes. It finds bottlenecks and ensures data is transferred quickly and correctly.
affaan-m/ECC
inventory-demand-planning
Helps your agent predict product demand in stores. It optimizes stock and plans when to run promotions to sell more.
affaan-m/ECC
market-research
Helps your agent conduct market research and competitive analysis. Provides summaries with source attribution.
affaan-m/ECC