A very basic tool for collecting new conntrack entries and storing them in the database.
As it was written for solving private particular task, lot of stuff is hardcoded and non-configurable, sorry.
That was my first expirience with Go, so don't expect it to be coded in a good way.
conntrack-logger is configured with a json file you specify with the -config flag:
conntrack-logger -config yourstuff.json
Sample config file is ditributed with source code, see conntrack-logger.cfg.
It it almost self descriptive, as only database connection details are configured.
-
The CommitCount parameter controls size of a single batch.
-
The Workers parameter controls how many processing goroutines will be running.
-
The Mark parameter will enable event filtering on their CONNMARK value. It is optional and when it is not set or set to 0, all events will be processed.
-
Install go
-
Install "lib/pq" go get -u github.com/lib/pq
-
Install libnetfilter-conntrack-dev and libnfnetlink-dev
-
Compile conntrack-logger
git clone git://github.com/akashihi/conntrack-logger.git cd conntrack-logger go build .
To build the packages, you will need ruby and fpm installed.
gem install fpm
Now you can build a package:
make deb
Package installs to /usr/bin.
You'll need to install libnetfilter-conntrack and libnfnetlink manually before using it.
Generally:
conntrack-logger -config conntrack-logger.cfg
Option '-config' can be omited, defaul config file location is '/etc/conntrack-logger.cfg'.
You will also need to install PostgreSQL server, create database, user and table. Table definition is in database.sql file.
See LICENSE file.
Copyright 2015 Denis V Chapligin akashihi@gmail.com