Reading width
Wide uses the full column for everything, text, diagrams, code, and exercises. Narrow keeps the standard reading width.
Text size
Scales the body text. Headings and code blocks keep their size.
In this section
0.8 Detection on the Endpoint
Introduction
Every lesson so far has asked a question and waited for the answer. Collections and hunts look at an endpoint as it is when the query runs, which is why lesson 0.5 worried about evidence that expires before anyone asks. Client monitoring turns that around: the endpoint runs a query that never finishes, and every time something happens that the query is watching for, a row goes to the server.
This lesson puts a built-in detection for SSH password guessing on the lab client, then guesses the password of a real account, deploy, four times before getting it right, with sshd and rsyslog writing to /var/log/auth.log as they would on any Ubuntu server.
The detection reports nothing. Finding out why, fixing it, proving the fix and acting on its rows at the server is the work of the lesson, and the reason Module 8 treats endpoint detection as something to test rather than something to switch on.
A Query That Never Ends
Client event artifactsThe Velociraptor documentation describes event queries as queries that never terminate, generating a row for each event that occurs. They are built from plugins that watch rather than list, usually named with a watch_ prefix: watch_syslog() follows a log file as it grows, watch_monitoring() follows another artifact's event stream, and on Windows watch_etw() and watch_evtx() follow event tracing and the event logs.
An artifact built from such a query declares type: CLIENT_EVENT, and only artifacts of that type can be put in client monitoring.
The second and third rows are what make monitoring different from everything in lessons 0.1 to 0.7. The documentation explains that the server sends each client its event table, the client saves it in its writeback file, and monitoring therefore starts whenever the client starts, whether or not the server is reachable.
While the client is offline, events queue in a local buffer and are sent when it reconnects. The server is needed only to change the table.
Each stage can fail on its own, and a failure anywhere upstream looks the same at the end: no rows.
The last row matters as much. The documentation is explicit that Velociraptor does nothing with collected events by default other than write them to storage. A row in the filestore is not an alert; it waits there until someone reads it or a server-side query does something with it, which section 6 builds.
A watching plugin also has a starting point, and it matters for what monitoring can claim. The reference page for watch_syslog() says that for a file named directly, the plugin seeks to the end of the file and forwards any new lines from it.
Lines already in the log when monitoring starts are skipped. Monitoring never looks back; reading what a log already holds is a collection's job, with parse_lines() or an artifact built on it, which is how section 4 reads the same file by hand.
The Event Table
Which clients run which monitoringMonitoring is assigned by label. Artifacts in the All group run on every client, subject to their own preconditions, and other groups run only on clients carrying a given label, with membership following the label as it is added and removed. A new server's table is short:
SELECT get_client_monitoring().artifacts.artifacts AS AllClients,
get_client_monitoring().label_events.label AS LabelGroups
FROM scope()The event table on a new server: one artifact for every client, and one label group.
The one artifact for every client, Generic.Client.Stats, reports the client's own processor and memory use, which is how an operator sees what monitoring costs on each host. The one label group, Quarantine, is attached to the artifact that keeps a quarantined Windows host isolated, the subject of Module 10.
Adding an artifact to the All group is a single function call, or a checkbox in the GUI's client events page. The built-in SSH brute-force detection went in next:
SELECT add_client_monitoring(artifact='Linux.Events.SSHBruteforce') AS Added FROM scope()
SELECT get_client_monitoring().artifacts.artifacts AS AllClients, get_client_monitoring().label_events.label AS LabelGroups FROM scope()
The built-in brute-force detection added to the All group, so every client runs it.
Adding it to the table is not the same as the client running it. A minute later, the client's monitoring log for the artifact was still empty:
LET Lab <= SELECT client_id FROM clients() WHERE os_info.hostname = 'ir-lab'
SELECT timestamp(epoch=_ts) AS Logged, message
FROM monitoring_logs(client_id=Lab[0].client_id, artifact='Linux.Events.SSHBruteforce')
WHERE message =~ 'Starting monitoring query|Registering watcher'The client's monitoring log for the artifact a minute after it was added to the table: nothing. The running client had not applied the change.
On the lab's 0.77.4 server, the running client did not apply the changed table on its own within that time. When the client restarted, it applied it at once, and its log records the query starting, with the next refresh of the table 11h16m48s away, and the watch on the authentication log beginning:
LET Lab <= SELECT client_id FROM clients() WHERE os_info.hostname = 'ir-lab'
SELECT timestamp(epoch=_ts) AS Logged, message
FROM monitoring_logs(client_id=Lab[0].client_id, artifact='Linux.Events.SSHBruteforce')
WHERE message =~ 'Starting monitoring query|Registering watcher'The same query after the client restarted: the query started, with its next refresh scheduled, and began watching the log.
The documentation allows up to about two minutes for events to appear after a new table is installed; the lab waited longer than that and saw no sign the table had been installed at all. Whatever the cause on a given release, the check is the same: after changing the table, read the client's monitoring log for the artifact and look for the query starting before relying on it.
Linux.Events.SSHBruteforce watches the authentication log for failed password logins, keeps the last hour of them in a first-in first-out buffer, and reports a successful password login for a user whose recent failures exceed its MinimumFailedLogins parameter, two by default.
Its description makes the case for it plainly: a password-guessing tool that succeeds usually reports the success and moves on, and an event at that moment may give an administrator time to lock the account before it is used.
Changes to the table reach clients without anyone touching the hosts, though not necessarily at once. The server holds the table, each client fetches it, and a label added to a client changes which groups it belongs to and so which artifacts it runs.
That makes labels the practical way to put a noisy or expensive artifact only where it is wanted: a web-tier label for an artifact that follows web server logs, a database label for one that follows the database's own audit log, the All group only for what every host should run. Generic.Client.Stats is there to measure the price of each choice, host by host.
A Detection That Saw Nothing
Real password guessing, and no rowsWith the artifact in the event table, the lab guessed the deploy account's password four times over SSH and then used the right one. sshd wrote every attempt, and rsyslog put it in /var/log/auth.log:
$ grep -E 'Failed password|Accepted password' /var/log/auth.log | tail -n 5
2026-12-02T19:21:37.482196+00:00 ir-lab sshd[6263]: Failed password for deploy from 127.0.0.1 p…
2026-12-02T19:21:42.000168+00:00 ir-lab sshd[6267]: Failed password for deploy from 127.0.0.1 p…
2026-12-02T19:21:45.054741+00:00 ir-lab sshd[6271]: Failed password for deploy from 127.0.0.1 p…
2026-12-02T19:21:50.554950+00:00 ir-lab sshd[6275]: Failed password for deploy from 127.0.0.1 p…
2026-12-02T19:21:52.910040+00:00 ir-lab sshd[6279]: Accepted password for deploy from 127.0.0.1…
That is exactly the pattern the artifact exists for: four failures for one user, then a success, inside a few seconds. The client's monitoring stream for the artifact, read after the documented 120-second batching window had passed:
LET Lab <= SELECT client_id FROM clients() WHERE os_info.hostname = 'ir-lab'
SELECT timestamp(epoch=_ts) AS Received, Event.user AS User,
Event.ip AS SourceIP, len(list=Failures) AS Failures
FROM monitoring(client_id=Lab[0].client_id, artifact='Linux.Events.SSHBruteforce')Two and a half minutes after four wrong passwords and a right one: nothing.
No rows. In an incident, this is the moment a report says that monitoring showed no brute force, and the log above says that report would be wrong.
Nothing in Velociraptor flagged a problem: the artifact was in the table, the client was connected, and section 2's log shows the query running and watching the file. A monitoring query that matches nothing produces nothing, and nothing is also what it produces when there is nothing to find.
The first row is the only cause anyone assumes. The others are ordinary, and every one of them looks the same from the server. The way through is the habit from lesson 0.1's flow log, carried over to monitoring: prove that the check can fire before reading anything into its silence.
The GUI does not help here as much as it seems to. The client's event page draws a timeline with an Available row marking the days that hold events for the chosen artifact; a day with no mark looks the same whether the artifact had nothing to report, was not deployed, or could not parse its source.
The only distinction the server can draw is between an artifact that is in the table and one that is not, and section 2 showed this one was in the table.
Why It Saw Nothing
A pattern that never matchedThe artifact turns each log line into fields with grok, a pattern language built from named sub-patterns, and its parameter shows the pattern it uses:
$ velociraptor artifacts show Linux.Events.SSHBruteforce | grep -A3 'name: SSHGrok'
- name: SSHGrok
description: A Grok expression for parsing SSH auth lines.
default: >-
%{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}…
The pattern starts with SYSLOGTIMESTAMP, the classic syslog form that begins with the month name. The lines above begin with a full date and time with fractions of a second and a time zone, the RFC 3339 form that Ubuntu 24.04's rsyslog writes by default. Running the artifact's own pattern over the file by hand, with the same pattern in SSHGrok, shows the result directly:
SELECT grok(grok=SSHGrok, data=Line) AS Parsed, Line
FROM parse_lines(filename='/var/log/auth.log')
WHERE Line =~ 'Failed password|Accepted password'The artifact's own pattern, run by hand against the same file: every line read, none parsed.
Every line was read, and for every line grok returned an empty result. The artifact then filtered on fields that did not exist, and no failure or success ever reached its buffer. Nothing about the account, the network or the client mattered; the detection failed on the first characters of each line.
The test took one notebook cell and a few seconds, against a log the host already held, and it is the test worth running before any text-parsing detection goes into an event table: point its pattern at the real file and count how many lines come back with fields.
The rest of the line is identical. A pattern that anchors on the first field fails on the first field.
This is not a bug peculiar to one artifact. Any detection that parses text depends on the exact format of the text, and that format belongs to whatever writes it: the distribution, the logging daemon's configuration, the version of sshd. A detection written against one estate and deployed on another inherits every one of those assumptions, silently.
On a fleet, the check is a hunt.
A collection that reads the first line of each host's authentication log, stacked by its first ten characters as lesson 0.7 stacked cron commands, shows at a glance how many forms the estate writes: hosts still on the classic form the artifact expects, hosts writing RFC 3339 like the Ubuntu 24.04 lab here, and hosts that log only to the systemd journal with no auth.log at all.
Each group needs its own pattern or its own source, and the hunt says which hosts fall in which before any detection is trusted with them.
Fixing It, and Proving the Fix
A custom copy that firesThe smallest change is the timestamp: replace SYSLOGTIMESTAMP and the optional facility with TIMESTAMP_ISO8601, which matches the RFC 3339 form. Tried by hand on the same lines first, it parsed every field:
SELECT grok(grok=SSHGrok, data=Line).timestamp AS timestamp,
grok(grok=SSHGrok, data=Line).event AS event,
grok(grok=SSHGrok, data=Line).user AS user
FROM parse_lines(filename='/var/log/auth.log')
WHERE Line =~ 'Failed password|Accepted password'The same lines with the timestamp pattern changed to TIMESTAMP_ISO8601: every field parsed.
The changed pattern went into a copy of the artifact, named Custom.Linux.Events.SSHBruteforce, created on the server with artifact_set() from the built-in definition with only that parameter's default changed. A copy rather than an edited parameter keeps the fix visible, versioned and separate from the built-in artifact, which a later release may change. The copy was added to the All group, and the guessing was repeated:
LET Lab <= SELECT client_id FROM clients() WHERE os_info.hostname = 'ir-lab'
SELECT timestamp(epoch=_ts) AS Received, Event.user AS User,
Event.ip AS SourceIP, len(list=Failures) AS Failures
FROM monitoring(client_id=Lab[0].client_id, artifact='Custom.Linux.Events.SSHBruteforce')The custom copy in the event table, the same guessing repeated: one row, 4 seconds after the successful login.
One row, carrying the user, the source address and the four failures that preceded the success. That row is the proof the detection works on this host, and it is the only kind of proof that counts: an event deliberately made, observed arriving. Deploying the artifact, or reading its definition, showed nothing of the sort.
Reading the definition does show what the detection will and will not catch once it parses, and three details are worth knowing before relying on it. It keeps failed logins in a first-in first-out buffer of at most 50 rows and one hour, so failures older than an hour are forgotten: a guesser that tries once every two hours never accumulates enough to fire.
It compares the failures with MinimumFailedLogins using greater-than, so the default of two fires on the third failure, not the second. And it only counts password failures, so guessing against keyboard-interactive authentication, or a stolen key used once, is outside it entirely. None of these is a defect. Each is a choice an analyst should know was made before a quiet month is read as a quiet month.
The latency is worth reading with care. Here the row was readable 4 seconds after the login, on a lab where client and server run in one process.
The documentation describes clients batching rows for up to 120 seconds by default before sending them, so a deployed fleet should be expected to deliver events in minutes rather than seconds, which is fast for an investigation and slow for anything that has to block an attacker.
Acting on Events at the Server
From stored rows to escalationA row in the filestore still has to reach a person. Server event artifacts, of type SERVER_EVENT, are the server's own never-ending queries, and they can follow any client artifact's stream with watch_monitoring(). The lab added one, Custom.Server.Escalate.SSHBruteforce, whose query names the host and keeps the fields an analyst needs:
SELECT ClientId, client_info(client_id=ClientId).os_info.hostname AS Host,
Event.user AS User, Event.ip AS SourceIP, len(list=Failures) AS Failures
FROM watch_monitoring(artifact='Custom.Linux.Events.SSHBruteforce')The query inside Custom.Server.Escalate.SSHBruteforce, a server event artifact, and the row it wrote: the client's event, with the host named, ready to forward.
A server artifact's rows are stored like a client's, under a client ID of its own: server. Reading them back means passing client_id='server' to monitoring() with the artifact's name, which is how the row above was read, and a notebook query that leaves the client ID out returns nothing, a small instance of this lesson's theme.
From here the row can go wherever the team works. The binary ships server artifacts that forward events to Elastic, open cases in TheHive and post to Slack, and an internal stream, Server.Internal.Alerts, which its definition describes as being for high-value alerts generated by client or server artifacts and expected to be low frequency.
The VQL alert() function feeds it, with a deduplication window of two hours by default so a burst of the same alert arrives once.
The division of labor matters for detection design. The documentation distinguishes broad monitoring, which forwards everything with little filtering, from targeted queries that embed the detection and forward few rows, each worth escalating. The brute-force artifact is the second kind: it does its judging on the endpoint and sends only the logins that matter, which keeps both the network and the analyst's queue quiet.
What the escalating artifact carries decides whether the person who receives it can act. The query above adds the hostname, because a client ID means nothing to someone on call, and keeps the user, the source address and the failure count, which are the three facts that decide the first move: lock the account, block the address, or both.
A row that says only that something happened on C.d89b809ae70d7eb3 sends its reader back to the console before anything can be done.
The same thinking runs the other way for volume: a server artifact that escalated every failed login rather than every success after failures would bury the one row that matters under hundreds that do not, and an on-call analyst who learns to ignore it is worse off than one who never had it.
Escalate the judgment, not the raw stream, and send the raw stream to storage or to a SIEM where it can be searched when it is needed.
What Endpoint Monitoring Needs
Sources, formats, kernels and timeEvery monitoring artifact rests on something outside Velociraptor, and the lab ran into one more of them.
The richest Linux event source in the binary is eBPF, small programs loaded into the kernel that report process starts, file opens and network connections as they happen; Linux.Events.EBPF and Linux.Events.TrackProcesses are built on it, with the program compiled into Velociraptor itself. On the kernel this course's lab was built on, it would not load:
$ velociraptor query "SELECT * FROM watch_ebpf(events='sched_process_exec') LIMIT 3" \
-v 2>&1 | grep -E 'EBPF|watch_ebpf|Completed' | cut -c 1-150
[DEBUG] 2026-12-02T19:25:18Z Loading EBPF program into kernel (This could take a while!)
[INFO] 2026-12-02T19:25:19Z watch_ebpf: program lkm_seeker_modtree_loop: load program: bad CO-R…
[INFO] 2026-12-02T19:25:19Z Completed query in 1.319900105s
The kernel refused the program, and the query completed with no rows, which is the silence of section 3 again in a different form.
Whether eBPF monitoring works depends on the kernel version and its configuration on each host, so it is a property to check per platform, not a feature to assume. This lesson used the authentication log for that reason, and its fix shows the cost of log-based monitoring in turn.
Windows endpoints sit on different ground. Their richest sources are the event logs and Event Tracing for Windows, which the client follows with watch_evtx() and watch_etw(), and which do not depend on loading anything into the kernel.
They carry their own version of section 4's problem, though: an event that is not enabled, or a log that rolls over before it is read, produces the same silence as an event that never happened. Module 8 builds detection on both platforms, with Sigma rules, and tests each one the way section 5 tested this one.
The last row is the limit no configuration fixes. Monitoring sees what happens after the event table reaches the client. Everything earlier is for collections and hunts, which is why the order in an incident is to collect what already happened and then put monitoring in place for what happens next.
Asking an Assistant
Bringing the evidence instead of the symptomAsked how to detect SSH brute force, an assistant named the built-in artifact and told the user to add it to monitoring, which is the step that produced the silence in section 3.
- You
How do I detect SSH brute force with Velociraptor?
- Assistant
Add Linux.Events.SSHBruteforce to client monitoring. It watches /var/log/auth.log and reports a successful login that follows several failed ones for the same user. Adjust MinimumFailedLogins to suit your environment, then review the events on the client's monitoring page.
- You
On Ubuntu 24.04 servers, rsyslog writes /var/log/auth.log lines that start with an RFC 3339 timestamp, for example 2026-12-02T19:21:52.910040+00:00 ir-lab sshd[6279]: Accepted password for deploy from 127.0.0.1 port 56076 ssh2. Velociraptor 0.77.4's Linux.Events.SSHBruteforce returns nothing for real password guessing. Why, and what is the smallest change that makes it work, and how do I prove it works before I rely on it?
- Assistant
The artifact's SSHGrok parameter begins with %{SYSLOGTIMESTAMP:timestamp}, which matches the classic "Dec 2 16:59:47" form, so on your lines grok returns an empty result and every row is filtered out. Change that part to %{TIMESTAMP_ISO8601:timestamp} and drop the optional facility, either in the parameter or in a custom copy of the artifact. Before relying on it, run the grok with parse_lines() over the existing auth.log in a notebook and check that the fields parse, then make several failed logins and one success on a test account and confirm a row arrives.
- Velociraptor
SELECT grok(grok=SSHGrok, data=Line).timestamp AS timestamp, grok(grok=SSHGrok, data=Line).event AS event, grok(grok=SSHGrok, data=Line).user AS user FROM parse_lines(filename='/var/log/auth.log') WHERE Line =~ 'Failed password|Accepted password'timestampeventuser2026-12-02T19:21:37.482196ZFaileddeploy2026-12-02T19:21:42.000168ZFaileddeploy2026-12-02T19:21:45.054741ZFaileddeploy2026-12-02T19:21:50.55495ZFaileddeploy2026-12-02T19:21:52.91004ZAccepteddeployThe same lines with the timestamp pattern changed to TIMESTAMP_ISO8601: every field parsed.
The second prompt carried a real log line, the platform and the symptom. With those, the reply found the timestamp mismatch, proposed the same change section 5 made, and asked for the proof: test the pattern on the existing log, then plant an attempt and watch for the row.
- Ubuntu 24.04 serversnames the platform whose logging differs
- start with an RFC 3339 timestampstates the format, which is the cause
- Accepted password for deploypastes a real line, so the answer can be tested against it
- returns nothing for real password guessingreports the symptom rather than asking for a tutorial
- prove it works before I rely on itasks for the test, not only the fix
The saving was real: the cause took one exchange to name. What made it possible was the pasted line, which only someone looking at the host could supply.
- HoldsThe artifact was in the client's event tableLinux.Events.SSHBruteforce listed in the All group
- HoldsThe log recorded the guessingfour Failed password lines and one Accepted in auth.log
- FailsThe artifact could parse those linesits grok returned {} for all five
- FailsA planted attempt had produced a rowno test was run until the silence was questioned
Both failing lines would have been invisible in a report. The detection was deployed, the log was complete, and the conclusion would still have been wrong.
Practice
Can the silence be trusted? your own VelociraptorThe scenario holds a brute-force detection that reported nothing for a month, the log it was meant to read, both artifacts' results and a parsing test. Decide what the silence means and what shows a detection working.
Then test a detection of your own. On a Linux machine with sshd, look at the first characters of a line in /var/log/auth.log to see which timestamp form it uses, run Linux.Events.SSHBruteforce's grok over the file with parse_lines() in a notebook, and if it parses nothing, make the custom copy with TIMESTAMP_ISO8601.
Add it to client monitoring, fail a login several times on a test account, succeed, and wait for the row.
Client monitoring runs event queries on the endpoint from the moment the client starts, buffers them offline and delivers them in batches, and the server stores them until a server event artifact acts on them.
A detection's silence means nothing until a planted event has made it fire, because a wrong format, a missing source, an unsupported kernel and an undeployed artifact all look like quiet. Lesson 0.9 takes rows from all of these places, collections, hunts and monitoring, and puts them in the one order that matters in an investigation: time.
Resources
Velociraptor changes quickly; where its documentation and this lesson disagree, the documentation is newer.