Skip to content

Repository files navigation

LeilFS Inotifier

A Go-based monitoring tool that watches LeilFS filesystem events and publishes them to NATS messaging system.

Overview

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.

Features

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

Installation

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@latest

Installation via Docker

docker compose build --no-cache
sudo docker compose down --remove-orphans
docker compose up -d

Installing dependencies

docker pull nats:latest

Configuration

Configuration 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.yml

Example configuration:

nats_url: "nats://localhost:4222"
nats_subject: "leilfs.events"
filter_registered_ops: true
sfsmaster: { host: "sfsmaster", port: 9418 }

Command Line Options

./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)

Usage

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

Testing

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

License

This project is licensed under the GNU General Public License v3.0 - see the COPYING file for details.

Support

For issues and questions:

  • Contact support@leil.io

  • Create an issue on GitHub

  • Check the LeilFS documentation

  • Review the troubleshooting section above

About

A Micro service that registers to LeilFS Metadata server to gather and register inode changes on the filesystem.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages