How firnsy/barnyard2 works
Project type and purpose
• Barnyard2 is a C-based, command-line, plugin-driven interpreter for Snort unified2 binary log files.
• Its sole purpose is to decouple Snort’s high-throughput packet capture from the work of parsing, formatting, and exporting alerts.
File structure
• Top-level directories:
• src/ ← core source code
– barnyard2.c, spooler.c, parser.c, decode.c, util.c, log.c, debug.c
– input-plugins/ ← unified2 reader
– output-plugins/ ← many alert sink plugins
– sfutil/ ← shared Snort utilities
• schemas/ ← SQL schema definitions for databases
• etc/ ← default configuration templates
• doc/ ← INSTALL and plugin-specific READMEs
• tools/ ← ancillary scripts (e.g., odlaw)
• Build/config: autogen.sh, configure.ac, Makefile.am, rpm/
• Key architectural pattern: a single process with
plugin loader → input plugins → core parser/spooler → output plugins.
README for additional insights
• Barnyard2 runs in batch or continuous modes (with optional bookmarking).
• Controlled by configuration file with two directive types:
• input processors (currently only unified2)
• output plugins (database, CSV, syslog, Bro, Prelude, etc.)
Elements
CLI → Loader → Spooler → Parser → Dispatcher → Plugins → External
Detail checklist
• Don’t omit any plugin category – there are dozens in output-plugins/
• Use of sfutil library under src/sfutil
• That input and output plugins share the plugbase API
• Annotation about GNU Autotools build/config layer