NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
file_integrity module sends events when a file is changed (created,
updated, or deleted) on disk. The events contain file metadata and hashes.
The module is implemented for Linux, macOS (Darwin), and Windows.
How it worksedit
This module uses features of the operating system to monitor file changes in realtime. When the module starts it creates a subscription with the OS to receive notifications of changes to the specified files or directories. Upon receiving notification of a change the module will read the file’s metadata and the compute a hash of the file’s contents.
At startup this module will perform an initial scan of the configured files and directories to generate baseline data for the monitored paths and detect changes since the last time it was run. It uses locally persisted data in order to only send events for new or modified files.
The operating system features that power this feature are as follows.
inotifyis used, and therefore the kernel must have inotify support. Inotify was initially merged into the 2.6.13 Linux kernel.
macOS (Darwin) - Uses the
FSEventsAPI, present since macOS 10.5. This API coalesces multiple changes to a file into a single event. Auditbeat translates this coalesced changes into a meaningful sequence of actions. However, in rare situations the reported events may have a different ordering than what actually happened.
The file integrity module should not be used to monitor paths on network file systems.
This module has some configuration options for tuning its behavior. The following example shows all configuration options with their default values for Linux.
- module: file_integrity paths: - /bin - /usr/bin - /sbin - /usr/sbin - /etc exclude_files: - '(?i)\.sw[nop]$' - '~$' - '/\.git($|/)' scan_at_start: true scan_rate_per_sec: 50 MiB max_file_size: 100 MiB hash_types: [sha1] recursive: false
- A list of paths (directories or files) to watch. Globs are not supported. The specified paths should exist when the metricset is started.
- A list of regular expressions used to filter out events for unwanted files. The expressions are matched against the full path of every file and directory. By default, no files are excluded. See Regular expression support for a list of supported regexp patterns. It is recommended to wrap regular expressions in single quotation marks to avoid issues with YAML escaping rules.
A boolean value that controls if Auditbeat scans over the configured file paths at startup and send events for the files that have been modified since the last time Auditbeat was running. The default value is true.
This feature depends on data stored locally in
path.datain order to determine if a file has changed. The first time Auditbeat runs it will send an event for each file it encounters.
scan_at_startis enabled this sets an average read rate defined in bytes per second for the initial scan. This throttles the amount of CPU and I/O that Auditbeat consumes at startup. The default value is "50 MiB". Setting the value to "0" disables throttling. For convenience units can be specified as a suffix to the value. The supported units are
The maximum size of a file in bytes for which
Auditbeat will compute hashes. Files larger than this size will not be
hashed. The default value is 100 MiB. For convenience units can be specified as
a suffix to the value. The supported units are
A list of hash types to compute when the file changes.
The supported hash types are
xxh64. The default value is
By default, the watches set to the paths specified in
pathsare not recursive. This means that only changes to the contents of this directories are watched. If
recursiveis set to
file_integritymodule will watch for changes on this directories and all their subdirectories.
The File Integrity module supports the common configuration options that are described under configuring Auditbeat. Here is an example configuration:
auditbeat.modules: - module: file_integrity paths: - /bin - /usr/bin - /sbin - /usr/sbin - /etc
Intro to Kibana
ELK for Logs & Metrics