A Go-based monitoring tool that watches LeilFS filesystem events and publishes them to NATS messaging system.
LeilFS Inotifier processes filesystem operation logs from LeilFS, translates inode numbers to human-readable paths, and publishes structured event messages to NATS for further processing or monitoring.
Real-time Filesystem Monitoring: Processes CREATE, MOVE, LENGTH, RELEASE, UNLINK from filesystem operations.
-
Inode-to-Path Translation: Converts inode numbers to full file paths using LeilFS metadata
-
NATS Integration: Publishes events to NATS messaging system for distributed processing
-
Comprehensive Logging: Structured logging with configurable log levels
Prerequisites
-
Go 1.16 or higher
-
LeilFS metadata server network connection.
-
NATS server (for message publishing)
Building from Source
git clone https://github.com/leil-io/leilfs-inotifier.git
cd leilfs-inotifier
go build Installation via Go
go install github.com/leil-io/leilfs-inotifier@latestInstallation via Docker
docker compose build --no-cache
sudo docker compose down --remove-orphans
docker compose up -dInstalling dependencies
docker pull nats:latestConfiguration File
Create a config.yaml file in one of the following locations:
- /etc/leilfs/inotifier/
- ./ (Current directory)
- ./config/
Pass config file as parameter:
./leilfs-inotifier -c /etc/leilfs/inotifier/config.ymlExample configuration:
nats_url: "nats://localhost:4222"
nats_subject: "leilfs.events"
filter_registered_ops: true
sfsmaster: { host: "sfsmaster", port: 9418 }./leilfs-inotifier --help
Available options:
--nats-url: NATS server URL (default: nats://localhost:4222)
--nats-subject: NATS subject (default: leilfs.events)
--log-level: Log level: debug, info, warn, error (default: info)Basic Usage
# Process changelog events received from sfsmaster server
./leilfs-inotifier --log-level debug
# Process all changelog events received from sfsmaster server
./leilfs-inotifier --filter-registered-ops false
# With custom NATS configuration
./leilfs-inotifier --nats-url nats://nats.example.com:4222 --nats-subject fs.events
# Use TLS
./leilfs-inotifier --log-level info --nats-url "nats://localhost:4222" --nats-subject "fs.leilfs" --log-file "/var/log/leilfs/inotifier.log" --filter-registered-ops true --use-tls true# Test with sample data
docker run -p 4222:4222 -ti nats:latest
nats sub "leilfs.events"
docker exec leilfs-inotifier tail -F /var/log/leilfs/inotifier.log
# Trigger fs operations, mkdir, touch, tree, copy...This project is licensed under the GNU General Public License v3.0 - see the COPYING file for details.
For issues and questions:
-
Contact support@leil.io
-
Create an issue on GitHub
-
Check the LeilFS documentation
-
Review the troubleshooting section above