This is a successful SSH login:
Nov 19 10:14:07 web01 sshd[48211]: Accepted password for root from 198.51.100.23 port 40122 ssh2 The password was right and sshd accepted it. Nothing in the line looks like an attack. If that password was stolen, the log reads exactly the same as when its owner uses it.
Two things about it are still odd. The server logs in UTC, so 10:14 there is 02:14 in Los Angeles, where everyone who has that password works. And in this example 198.51.100.23 is an address in the Netherlands, where nobody on the team has ever logged in from.
You can't predict what an attacker will do or which tools they'll bring. You can predict your own users: when they work and where they log in from. Write that down, and any login that doesn't fit it is worth a look.
Take a small company with offices in California and Florida and a support team in Vancouver. Twenty people use SSH, the VPN and webmail, roughly 6am to 9pm Pacific, Monday to Friday. Two things barely change from one week to the next: when they log in and which country they log in from.
That's the whole profile. Monday to Friday, 06:00 to 21:00, United States and Canada. Once it's set, any login outside it gets a review.
It will be wrong sometimes. Someone on call fixes a full disk at 3am. Someone logs in from a hotel in London. A backup job logs in over SSH every night at 02:30. Each of those is one line in an ignore list or one more country on the list (more on that below).
These are the lines Trunc's behavior rules act on, with the alert title each one produces. The examples use the profile above: time zone America/Los_Angeles, Monday to Friday 06:00-21:00, and Linux hosts that log in UTC.
Nov 19 10:14:07 web01 sshd[48211]: Accepted publickey for deploy from 203.0.113.45 port 51544 ssh2
Alert: Behavior: Login outside working hours. Password or key makes no difference. Any successful login counts: SSH (including Dropbear), Windows console and RDP, WordPress, Azure and SharePoint, GlobalProtect and Meraki VPN, and FortiGate admin logins. Dovecot IMAP/POP logins count too if you turn them on.
Nov 19 10:14:07 web01 sshd[48211]: Accepted publickey for root from 203.0.113.45 port 51544 ssh2
Alert: Behavior: Root login outside working hours.
Nov 19 07:41:52 db02 sudo: alice : TTY=pts/1 ; PWD=/home/alice ; USER=root ; COMMAND=/usr/bin/cat /etc/shadow
Alert: Behavior: sudo outside working hours. Only sudo that actually ran a command as root counts. A wrong password at the sudo prompt is the separate Failed sudo alert.
Nov 19 07:58:10 db02 su: Successful su for root by alice
Alert: Behavior: su to root outside working hours. This one depends on how su logs on your system. We match Successful su for root by <user> and the + /dev/pts/1 alice:root format. If your su writes neither, this alert won't fire.
2026/11/19 03:12:40 WinEvtLog: Security: AUDIT_SUCCESS(4624): Microsoft-Windows-Security-Auditing: ... An account was successfully logged on. ... Logon Type: 10 ... Elevated Token: Yes ... New Logon: ... Account Name: jsmith ... Source Network Address: 203.0.113.45 ...
Logon type 10 is RDP, and Elevated Token: Yes means jsmith logged in with admin rights. Alert: Behavior: Admin login outside working hours. A console or RDP logon as Administrator gets the same title.
A 4624 with Logon Type: 2 (or 11, cached credentials) on DESKTOP-4K2M9QX is someone sitting at that machine. Alert: Behavior: Desktop login outside working hours.
Windows logs a lot of logons that are not a person. Network logons (type 3, a file share for example) and Kerberos service tickets (4769) never count as logins. SYSTEM, LOCAL SERVICE, NETWORK SERVICE, ANONYMOUS LOGON, the DWM-n and UMFD-n accounts and machine accounts ending in $ are skipped.
Logging in is step one. The next steps tend to be an account or a service that survives a password change.
Nov 19 11:02:44 web01 useradd[51920]: new user: name=sysupd, UID=1002, GID=1002, home=/home/sysupd, shell=/bin/bash, from=/dev/pts/0
03:02 in Los Angeles, and a new account named to look like a system user. Alert: Behavior: User added outside working hours. Windows 4720, new Azure AD users and users created through the Linode API count too. groupadd on its own doesn't.
2026/11/19 01:37:05 WinEvtLog: System: INFORMATION(7045): Service Control Manager: SYSTEM: NT AUTHORITY: FS01: A service was installed in the system. Service Name: RemoteSvc Service File Name: C:\Windows\Temp\rsvc.exe Service Type: user mode service Service Start Type: auto start Service Account: LocalSystem
An auto-start service running from C:\Windows\Temp as LocalSystem deserves a look at any hour. At 01:37 it's Behavior: New service outside working hours. Windows Defender definition updates are left out. We walked through a real 7045 left behind by an attacker in the Cisco breach logs.
The second half of the profile is a list of countries. Pick the ones your team works from under Settings > Business countries, and any successful login with a source IPv4 address outside them alerts. This one runs at any hour.
Nov 19 15:02:31 web01 sshd[50112]: Accepted password for deploy from 198.51.100.23 port 40122 ssh2
That's 07:02 in Los Angeles, inside working hours. If 198.51.100.23 is outside the United States and Canada, the alert is Behavior: Login from outside your business countries. When a login is both off-hours and from outside your countries, you get one alert with both in the title:
Behavior: Login outside working hours, from outside your business countries The country check has limits:
With Login outside working hours, root or sudo outside working hours and Login from outside your business countries switched on for one email address, the root login from the top of this article sends this:
Subject: Trunc Alert: Behavior: Root login outside working hours, from outside your business countries
Email Alert triggered for the following event:
Alert name: Behavior: Root login outside working hours, from outside your business countries
Alert description: Someone logged in over SSH as root outside your working hours. A successful login from an IPv4 address outside your business countries.
Location: web01
Log file: /var/log/auth.log
Full log:
Rules: Login outside working hours; root or sudo outside working hours; Login from outside your business countries
User: root
Host: web01
Source: 198.51.100.23 (NL)
Processed: Thu 2026-11-19 02:14 PST (America/Los_Angeles)
Nov 19 10:14:07 web01 sshd[48211]: Accepted password for root from 198.51.100.23 port 40122 ssh2
You can customize your alerts here:
https://my.trunc.org/dashboard?page=logging&subpage=alerts
If you have any questions, please contact us at support@noc.org
Look at the Processed: line. The rules use the time Trunc processed the line, in your account's time zone. That's usually seconds after the host wrote it. The timestamp inside the line isn't used, so a host with its clock in UTC (like this one) or set wrong doesn't change the result.
Slack gets the same title, the host and the log in a code block. Every alert we send is also listed under Alert history (filter by Behavior), kept for 24 months.
Lines that match Login outside working hours, Desktop login outside working hours or Login from outside your business countries also get the MITRE ATT&CK tag T1078 (Valid Accounts).
An alert nobody reads is worse than no alert. These are the defaults and the knobs:
Behavior: hourly alert limit reached with a count per rule. The events are still stored and searchable. The limit can be 5, 10, 20, 50 or 100, and it's separate from your other alerts' hourly cap.Never alert for these users:
svc_backup
ci-runner*
Never alert for these hosts:
bastion*
Never alert for these source IPs:
192.0.2.0/28
A trailing * matches a prefix, and web01 also matches web01.example.com. For sudo and su, the user is the one who ran the command.
category:behavior_* (or one rule, such as category:behavior_offhours_root) to list every match, including the ones the limits held back, then follow the user and the address from there. Threat hunting using your logs has the searches we use. Only rules you've switched on tag events.These are listed on the settings page and don't fire yet. Some need a per-user history we're still building.
Behavior rules are on every plan, including the free trial. The full list is on the Behavior rules page.
If a line from your logs should have fired one of these and didn't, send it to us. We'll tell you why and fix the rule if it's ours.
We love logs. In this section we will share some articles from our team to help you get better at logging.
Logging for fun and a good night of sleep.
Latest articles from our learning center.
Do you have an idea for an article that is not here? See something wrong? Contact us at support@noc.org
14 days free trial. No credit card required.