Falco watches Linux system calls and tells you when something happens that should not: a shell opening inside a container, a process reading /etc/shadow, a binary writing under /usr/bin at three in the morning. It detects, it does not enforce — it will not stop the action, it will describe it precisely and hand you an alert. The install takes fifteen minutes; what decides whether Falco earns its keep or gets muted after a week is rule tuning. This guide covers both: getting a driver loaded on a plain Linux host, then reading and writing the rule syntax well enough to silence a false positive surgically instead of switching the whole rule off.
What you’ll accomplish
- Falco running as a systemd service on a Debian or RHEL-family host, with the driver that matches your kernel.
- A clear picture of which rules file owns what, so a package upgrade never eats your work.
- One custom rule that detects something real in your environment, plus one exception that silences a known-good process without weakening the rule.
- The classic noisy defaults tuned down, and output routed somewhere a human actually reads.
- A deliberately triggered detection, so you know the whole chain works end to end.
Prerequisites
- A Linux host with
sudoand outbound HTTPS todownload.falco.org. Debian 12, Ubuntu 22.04/24.04, RHEL 9 and derivatives are all first-class. - Kernel version matters more than distribution version.
uname -rof 5.8 or newer gets you the modern eBPF driver with no compilation at all. Below that you need the kernel module or the legacy eBPF probe, both of which want kernel headers. - For the kernel module path only:
dkms,makeand the matchinglinux-headerspackage. On RHEL that iskernel-devel-$(uname -r). - Root-equivalent access. Falco loads a driver and reads kernel events — there is no unprivileged mode.
- This guide targets the Falco 0.4x line. Rule syntax moved meaningfully at 0.36 (the
overridemechanism replaced the olderappend: true) and container metadata moved into a plugin around 0.41. If you inherited an older install, checkfalco --versionbefore copying anything here. - On Kubernetes, do not install the package on nodes. Use the Helm chart, which runs Falco as a DaemonSet and takes rules through a ConfigMap. The rule syntax below is identical; only the delivery differs.
How it works
Falco has two halves that fail for different reasons, and knowing which half is broken saves most of the debugging time.
The kernel half is the driver. It hooks syscall entry and exit and pushes event records into a ring buffer shared with userspace. Three implementations exist. modern_ebpf is CO-RE-based: it ships inside the Falco binary, needs nothing compiled, and requires kernel 5.8 or newer for the BPF ring buffer. kmod is the original falco.ko module, built locally through DKMS; it works on old kernels at the cost of a rebuild every time the kernel changes. ebpf is the legacy probe, a probe.o object that falcoctl downloads or builds. Pick modern_ebpf unless the kernel forbids it.
The userspace half is the rules engine. Every event off the ring buffer is tested against every enabled rule condition. Conditions are built from three primitives: a list is a named set of values, a macro is a named condition fragment, and a rule ties a condition to an output template, a priority and a set of tags. The shipped ruleset leans on this heavily — a condition like spawned_process and container and shell_procs is three macros stacked, which is exactly why redefining one macro retunes broad behaviour.
The two halves fail independently. No events at all is a driver problem. Events flowing but your rule never firing is a condition problem.
Step-by-step
-
Add the official repository and install. Falco’s own repository carries current builds; distribution packages are usually far behind.
curl -fsSL https://falco.org/repo/falcosecurity-packages.asc | \ sudo gpg --dearmor -o /usr/share/keyrings/falco-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/falco-archive-keyring.gpg] https://download.falco.org/packages/deb stable main" | \ sudo tee /etc/apt/sources.list.d/falcosecurity.list sudo apt update sudo apt install -y falcoExpected:
aptresolvesfalcofromdownload.falco.org. On a Debian-family host the package runs a debconf dialog asking which driver and which systemd unit you want — pick the modern eBPF option if your kernel qualifies. On RHEL, usednfwith the equivalentrpmrepository from the same documentation page. -
Confirm which driver you actually got. The debconf choice is easy to click through wrongly.
falco --version systemctl list-units 'falco*' --all --no-legendExpected: a version line such as
Falco version: 0.41.3, and exactly one enabled unit amongfalco-modern-bpf.service,falco-bpf.serviceandfalco-kmod.service. If two are enabled, disable the one you do not want — they will fight over the driver. -
Set the driver explicitly if the dialog got it wrong. The engine choice lives in
/etc/falco/falco.yaml:engine: kind: modern_ebpf modern_ebpf: cpus_for_each_buffer: 2 buf_size_preset: 4Then switch units and restart:
sudo systemctl disable --now falco-kmod.service sudo systemctl enable --now falco-modern-bpf.service sudo systemctl status falco-modern-bpf.service --no-pagerExpected:
Active: active (running), and in the logLoaded event sources: syscallfollowed byEnabled event sources: syscall. If you are stuck on the kernel module,falcoctl driver installbuilds and loadsfalco.kofor the running kernel, andlsmod | grep falcoconfirms it. -
Learn the file layout before you edit anything. Falco loads rule files in the order listed in
falco.yaml, and later definitions win over earlier ones.grep -A5 '^rules_files' /etc/falco/falco.yamlExpected: three entries —
/etc/falco/falco_rules.yaml,/etc/falco/falco_rules.local.yamland/etc/falco/rules.d. The first is package-owned and gets replaced on every upgrade; treat it as read-only reference. Everything you write goes in the second, or a file under the third. -
Read a rule. Print one from the shipped set rather than trusting a blog’s paraphrase.
falco -l 'Terminal shell in container'Expected: the rule printed with its
condition,output,priorityandtags. Six fields carry the whole model:ruleis the unique name,descis prose for whoever gets paged,conditionis the filter expression,outputis a template with%-prefixed field references,priorityruns fromEMERGENCYtoDEBUG, andtagsgroup rules for bulk enable and disable. -
Write a custom rule. Put it in
/etc/falco/rules.d/local-detections.yaml. This one catches a package manager running inside a container — near-certain sign of someone patching a running production container by hand, or of an attacker installing tools.- list: package_mgmt_binaries items: [apt, apt-get, dpkg, yum, dnf, rpm, apk, pip, pip3] - macro: in_container condition: container.id != host - rule: Package manager run in container desc: A package manager was executed inside a running container, which usually means a hand patch or an attacker staging tools condition: > spawned_process and in_container and proc.name in (package_mgmt_binaries) output: > Package manager launched in container (user=%user.name command=%proc.cmdline container=%container.name image=%container.image.repository) priority: WARNING tags: [container, process, mitre_execution]Note the shape: a
listfor the value set so you extend it in one place, a macro for the container test, andspawned_processreused from the shipped ruleset. Validate before restarting — a syntax error takes Falco down:sudo falco -V /etc/falco/rules.d/local-detections.yamlExpected:
Okand no warnings. A rule referencing an unknown field prints the offending name and the line number. -
Add an exception for the process you know is fine. Your image build pipeline or a configuration agent will trip the rule above. The wrong fix is disabling the rule; the right one is an exception, which narrows the condition and leaves the detection intact.
- rule: Package manager run in container exceptions: - name: build_agent fields: [proc.pname, container.image.repository] comps: [=, startswith] values: - [buildkitd, registry.example.com/ci/] override: exceptions: appendfieldsnames what to compare,compsnames the comparison operators positionally, and each entry invaluesis a tuple matched against them.override: exceptions: appendis what tells Falco to extend the existing rule rather than redefine it — without it you get a duplicate-rule warning and the last definition silently replaces the first. -
Tune the noisy defaults. Three shipped rules generate most first-week complaints. Rather than deleting them, narrow them in
/etc/falco/falco_rules.local.yaml:- macro: user_known_write_below_etc_activities condition: (proc.name in (puppet, chef-client, salt-minion, cloud-init)) - rule: Read sensitive file untrusted condition: and not proc.name in (node_exporter, telegraf) override: condition: appendThe first redefines a macro the shipped ruleset already leaves as an extension point — a redefinition replaces it wholesale, so include everything you want kept. The second appends to a rule condition, which is why the fragment starts with
and. Reload and confirm:sudo systemctl reload falco-modern-bpf.service sudo journalctl -u falco-modern-bpf.service -n 20 --no-pagerExpected:
Rules files loadedwith noWarninglines. Warnings about unknown fields or duplicate rule names mean your file was parsed but partly ignored. -
Route the output somewhere real. stdout into journald is fine for one host and useless for twenty. In
falco.yaml:json_output: true json_include_output_property: true http_output: enabled: true url: http://127.0.0.1:2801/ priority: notice outputs: rate: 0.03333 max_burst: 20prioritysets the minimum severity Falco will even load rules for — leave it atdebugwhile tuning, then raise it.http_outputon port 2801 is the standard falcosidekick handoff, and falcosidekick fans out to Slack, PagerDuty, Alertmanager and the rest. Theoutputsblock is a token bucket capping sustained alert rate: your insurance against a loop that fills a disk. For custom consumers, enable the gRPC server instead with thegrpcandgrpc_outputblocks; it speaks mTLS over a Unix socket or TCP.
Validate it works
Do not assume. Trigger a detection on purpose and follow it all the way to the output.
Start by watching the log in one terminal:
sudo journalctl -fu falco-modern-bpf.service
In another, read a sensitive file with an untrusted program:
sudo cat /etc/shadow > /dev/null
Expected: within a second, a line like Warning Sensitive file opened for reading by non-trusted program (file=/etc/shadow ...). If you enabled json_output, it arrives as a single JSON object with rule, priority, output_fields and time keys.
Now trigger your own rule, if you have a container runtime on the host:
docker run --rm -it debian:12 apt-get --version
Expected: Warning Package manager launched in container (user=root command=apt-get --version container=... image=debian). If the alert appears with an empty container= field, the container metadata plugin is not enriching events — see the troubleshooting note below.
Then confirm the exception really silences rather than merely looking plausible: run the same binary under the parent process you excluded and confirm no alert appears. Falco does not error on an exception that can never match, so an untested exception is usually a typo in a field name.
Last, check that Falco is keeping up with the kernel:
sudo journalctl -u falco-modern-bpf.service | grep -i drop | tail -5
Expected: nothing, or a metrics line with n_drops at zero. Non-zero drops mean events are being lost, and a detection you never saw is worse than no detection at all.
Troubleshooting
- The service starts, then exits with a driver error. Read the exact message.
Unable to load the driverfrom the modern eBPF unit on a kernel below 5.8 is the common case — switch tofalco-kmod.serviceand runfalcoctl driver install. If the module build fails, you are missinglinux-headers-$(uname -r). With Secure Boot enabled, an unsignedfalco.korefuses to load and modern eBPF is the only practical answer. - Falco is running but no events arrive. Confirm the driver is really attached:
lsmod | grep falcofor the module path, and for eBPF check the startup log forEnabled event sources: syscall. An empty source list meansfalco.yamlhas every source disabled, usually from a copied config. Also check you are tailing the right unit’s journal — the three units log separately. - Events flow but your rule never fires.
falco -Llists every loaded rule; if yours is absent, the file is not inrules_files, or the rule’spriorityis below theprioritythreshold infalco.yaml, or a syntax warning made Falco skip it. A rule that loads but never matches usually has a field with the wrong semantics —proc.nameis the binary name only, soproc.name = /usr/bin/aptnever matches anything. - Alert flood after enabling the full ruleset. Sort the noise before muting anything: with
json_outputon,journalctl -u falco-modern-bpf -o cat | jq -r .rule | sort | uniq -c | sort -rnranks rules by volume. Three or four rules usually account for most of it, and each deserves an exception rather than a deletion. Setoutputs.rateandoutputs.max_burstmeanwhile so the flood cannot fill the disk. - Container fields are empty in every alert. On recent releases container metadata comes from a
containerplugin rather than being built in. Confirm it is listed underload_pluginsinfalco.yaml, and that the runtime socket it needs is readable —/run/containerd/containerd.sockor/var/run/docker.sock. This is the usual cause of the same symptom on Kubernetes, where the socket path differs per node image. - Your changes vanished after an upgrade. You edited
/etc/falco/falco_rules.yaml, which belongs to the package. Move everything intofalco_rules.local.yamlor a file under/etc/falco/rules.d/.
When this is the wrong approach
Falco detects; it does not prevent. If what you need is to stop a process from reading a file or opening a socket, you want a mandatory access control layer — AppArmor profiles or SELinux, plus seccomp for syscall filtering. Falco pairs well with those, telling you when a policy is being probed, but it is not a substitute.
If your requirement is an audit trail for a compliance framework rather than alerting, auditd rules are the better fit. auditd writes records with a defined retention model and is named explicitly in most control catalogues; Falco optimises for a small number of high-signal alerts, not for complete recording.
On a host already dropping syscall events under load, Falco makes the problem worse before it makes anything better. Fix capacity first, or start with a tag filter (falco -t container) rather than the full default set.
And if nobody is going to read the alerts, do not deploy it. A detection tool with no response path is a disk consumer with extra steps. Decide who gets the page, and when, before you enable the first rule.
The authoritative reference is the Falco documentation, which tracks the rule syntax changes release by release.
If alerts fire into an empty room after hours, that’s exactly what 24/7 Monitoring & Response closes — book a monitoring and response review.