Investigate Syslog Sources¶
Parse syslog-formatted logs (RFC 3164 / RFC 5424) to surface security events, infrastructure issues, and service-level anomalies.
When to Use This Guide¶
- Auditing authentication activity (
sshd,sudo, VPN) on Linux systems. - Monitoring routers, firewalls, or load balancers that emit syslog.
- Building quick, scriptable reports without standing up a SIEM.
Before You Start¶
- Examples use
examples/simple_syslog.log. Replace it with/var/log/syslog,/var/log/auth.log, or device exports. - Syslog encodes both severity (0–7) and facility (0–23). Keep a cheat sheet nearby for your environment.
- If timestamps appear with unusual formats, consult
kelora --help-timeand be ready to specify--ts-format.
Step 1: Inspect the Stream¶
Confirm parsing works and note which fields are available.
Common fields:
timestamp,hostname,process,pid,messagefacility(integer code) andseverity(0 = emergency, 7 = debug)- Some devices include structured data in
message; plan to parse it with Rhai helpers.
Step 2: Filter by Severity or Facility¶
Focus on critical events first, then expand scope.
kelora -f syslog /var/log/syslog \
--filter 'e.severity <= 3' \
-k timestamp,hostname,process,message
Helpful ranges:
<= 2for emergencies/alerts/critical.== 4for warnings.- Facility codes:
0Kernel,3System daemons,4Auth/Security,10Auth (private),16+Local use.
Step 3: Target Specific Services¶
Investigate authentication flows or infrastructure components.
kelora -f syslog /var/log/auth.log \
--filter 'e.process == "sshd" && e.message.contains("Failed password")' \
-e 'e.username = e.message.extract_regex(r"for ([^ ]+)", 1)' \
-k timestamp,hostname,username,message
- Combine multiple processes:
--filter 'e.process == "sudo" || e.process == "su"'. - Use
extract_re()orparse_kv()to decode structured messages (firewalls, network gear).
Step 4: Add Enrichment and Metrics¶
Capture per-host or per-IP trends while reviewing raw events.
kelora -f syslog /var/log/syslog \
--filter 'e.severity <= 3' \
-e 'let ip = e.message.extract_ip(); if ip != "" { track_count(ip) }' \
--metrics
track_count(e.hostname)surfaces noisy machines.- Record severity names for reporting:
Step 5: Export for Stakeholders¶
Hand off filtered events to incident responders or auditors.
kelora -f syslog /var/log/syslog \
--since "today 00:00" \
--filter 'e.severity <= 3' \
-k timestamp,hostname,process,severity,message \
-F csv > syslog-critical.csv
Alternatives:
-Jfor JSON exports consumed by log analytics tools.- Use
-qwhen running inside scripts that only care about exit codes or metrics.
Variations¶
- RFC 5424 structured data
-
Network device monitoring
-
Time-boxed reporting
Troubleshooting¶
- Timestamps not recognised: specify
--ts-formatmatching the source (e.g.,%b %e %H:%M:%Sfor classic syslog). - Facility/severity seems wrong: some appliances offset the code; inspect
e.priorityand decode manually withe.priority / 8(facility) ande.priority % 8(severity). - Parsing stops: enable
--verboseto view problematic lines; consider--strictonce the pipeline is stable.
See Also¶
- Analyze Web Traffic for HTTP access logs that complement syslog-level insights.
- Triage Production Errors when application logs, not syslog, contain the signal.
- Concept: Performance Model if you need to process multi-GB syslog archives quickly.