Skip to content

Deploy Falco for runtime threat detection and write rules that stay quiet

Install Falco from the official repository, pick between the modern eBPF probe, the kernel module and the legacy probe, learn the rules file layout and rule anatomy, write a custom rule and an exception that silences a known-good process, tune the noisy defaults, route output, and prove a detection fires.

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 sudo and outbound HTTPS to download.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 -r of 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, make and the matching linux-headers package. On RHEL that is kernel-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 override mechanism replaced the older append: true) and container metadata moved into a plugin around 0.41. If you inherited an older install, check falco --version before 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.

Data path diagram showing kernel syscalls flowing into the Falco driver, either the modern eBPF probe requiring kernel 5.8 or later, the kernel module falco.ko built with DKMS, or the legacy eBPF probe, then into a shared per-CPU ring buffer, then into the userspace rules engine built from lists, macros and rules, and finally out to stdout and file, http_output to falcosidekick, or the gRPC API

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

  1. 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 falco

    Expected: apt resolves falco from download.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, use dnf with the equivalent rpm repository from the same documentation page.

  2. Confirm which driver you actually got. The debconf choice is easy to click through wrongly.

    falco --version
    systemctl list-units 'falco*' --all --no-legend

    Expected: a version line such as Falco version: 0.41.3, and exactly one enabled unit among falco-modern-bpf.service, falco-bpf.service and falco-kmod.service. If two are enabled, disable the one you do not want — they will fight over the driver.

  3. 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: 4

    Then 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-pager

    Expected: Active: active (running), and in the log Loaded event sources: syscall followed by Enabled event sources: syscall. If you are stuck on the kernel module, falcoctl driver install builds and loads falco.ko for the running kernel, and lsmod | grep falco confirms it.

  4. 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.

    Diagram of Falco rule file precedence showing falco_rules.yaml shipped by the package and never to be edited, falco_rules.local.yaml holding your overrides and surviving upgrades, and rules.d holding extra files, next to a three-step ladder for silencing a false positive: add an exception, redefine a macro, or disable the rule

    grep -A5 '^rules_files' /etc/falco/falco.yaml

    Expected: three entries — /etc/falco/falco_rules.yaml, /etc/falco/falco_rules.local.yaml and /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.

  5. 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, priority and tags. Six fields carry the whole model: rule is the unique name, desc is prose for whoever gets paged, condition is the filter expression, output is a template with %-prefixed field references, priority runs from EMERGENCY to DEBUG, and tags group rules for bulk enable and disable.

  6. 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 list for the value set so you extend it in one place, a macro for the container test, and spawned_process reused from the shipped ruleset. Validate before restarting — a syntax error takes Falco down:

    sudo falco -V /etc/falco/rules.d/local-detections.yaml

    Expected: Ok and no warnings. A rule referencing an unknown field prints the offending name and the line number.

  7. 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: append

    fields names what to compare, comps names the comparison operators positionally, and each entry in values is a tuple matched against them. override: exceptions: append is 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.

  8. 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: append

    The 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-pager

    Expected: Rules files loaded with no Warning lines. Warnings about unknown fields or duplicate rule names mean your file was parsed but partly ignored.

  9. 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: 20

    priority sets the minimum severity Falco will even load rules for — leave it at debug while tuning, then raise it. http_output on port 2801 is the standard falcosidekick handoff, and falcosidekick fans out to Slack, PagerDuty, Alertmanager and the rest. The outputs block 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 the grpc and grpc_output blocks; 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 driver from the modern eBPF unit on a kernel below 5.8 is the common case — switch to falco-kmod.service and run falcoctl driver install. If the module build fails, you are missing linux-headers-$(uname -r). With Secure Boot enabled, an unsigned falco.ko refuses 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 falco for the module path, and for eBPF check the startup log for Enabled event sources: syscall. An empty source list means falco.yaml has 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 -L lists every loaded rule; if yours is absent, the file is not in rules_files, or the rule’s priority is below the priority threshold in falco.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.name is the binary name only, so proc.name = /usr/bin/apt never matches anything.
  • Alert flood after enabling the full ruleset. Sort the noise before muting anything: with json_output on, journalctl -u falco-modern-bpf -o cat | jq -r .rule | sort | uniq -c | sort -rn ranks rules by volume. Three or four rules usually account for most of it, and each deserves an exception rather than a deletion. Set outputs.rate and outputs.max_burst meanwhile so the flood cannot fill the disk.
  • Container fields are empty in every alert. On recent releases container metadata comes from a container plugin rather than being built in. Confirm it is listed under load_plugins in falco.yaml, and that the runtime socket it needs is readable — /run/containerd/containerd.sock or /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 into falco_rules.local.yaml or 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.