T1070.002

Clear Linux or Mac System Logs

Adversaries clear system logs on Linux and macOS to remove evidence of intrusion. Primary targets include /var/log/auth.log or /var/log/secure (authentication), /var/log/syslog or /var/log/messages (general), /var/log/wtmp and /var/log/btmp (login records), and web server logs (/var/log/apache2/, /var/log/nginx/). Common methods include truncating files (echo > /var/log/auth.log), deletion (rm /var/log/*.log), or overwriting with zeros. TeamTNT (crypto-mining), Rocke, Sea Turtle (DNS hijacking), Salt Typhoon (telecom espionage), UPSTYLE (Volt Typhoon PANW exploit), and MacMa (macOS) have all cleared Linux/macOS logs post-compromise.

Microsoft Sentinel / Defender
kusto
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileDeleted", "FileModified", "FileTruncated")
| where FolderPath startswith "/var/log/" or FolderPath startswith "/Library/Logs/" or FolderPath startswith "/private/var/log/"
| where FileName endswith ".log" or FileName in~ ("auth.log", "syslog", "messages", "secure", "wtmp", "btmp", "lastlog", "kern.log")
| where not(InitiatingProcessFileName in~ ("logrotate", "newsyslog", "rsyslog", "syslogd"))
| project Timestamp, DeviceName, AccountName=InitiatingProcessAccountName,
         ActionType, FileName, FolderPath, InitiatingProcessFileName,
         InitiatingProcessCommandLine
| sort by Timestamp desc
high severity high confidence

Data Sources

File: File Deletion File: File Modification Microsoft Defender for Endpoint (Linux/macOS)

Required Tables

DeviceFileEvents

False Positives

  • Logrotate and newsyslog performing scheduled log rotation — though they archive rather than delete
  • System administrators manually clearing logs after legitimate troubleshooting
  • Docker container cleanup processes removing application logs
  • Some security tools that manage their own log files in /var/log directories

Unlock Pro Content

Get the full detection package for T1070.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections