fln / addrwatch

A tool similar to arpwatch for IPv4/IPv6 and ethernet address pairing monitoring.
GNU General Public License v3.0
184 stars 30 forks source link

Compact database format #22

Open tdussa opened 3 years ago

tdussa commented 3 years ago

Fixes #21.

fln commented 3 years ago

Hi @tdussa, first of all thanks for the pull-request and contribution to this project.

The original idea and use-case of addrwatch for me was to have log-like structure. But we can include compact mode as well if you have use case for it.

However it would be great to add it as a separate output module. Since addrwatch v1.0 I had plans to convert all the output modes to separate binaries like addrwatch_mysql, addrwatch_syslog, addrwatch_stdout. The sqlite output was left bundled with the main binary because it was never used in production environment.

I think it would be better to keep the two modes as separate binaries, because there is fundamental change in the data we store (history of changes vs current state).

Could you move out sqlite compact mode to separate binary in this PR?

tdussa commented 3 years ago

Hi,

so, yes, in principle, of course I can refactor my code. Not a problem, my changes are fairly simple. (Where do I find the code for the separate modules, incidentally?)

However, I am not sure it really makes sense to have compact mode as a separate output module, to be honest. In fact, whether or not the DB schema is compact or verbose is completely independent of, for instance, whether MySQL or SQLite is used. I think the right way would be either to include the "compact" version in the MySQL code as well (which I would have done if I had found the source for that XD) or to have "SQL verbose" and "SQL compact" output modules that are configurable in terms of which backend they use.

Having a separate binary for every backend/output variant combination seems to me to be likely to generate a lot of unnecessarily redundant code in the long run.

tdussa commented 3 years ago

Ah. The source for the individual modules is located in the shm-buffer branch?

fln commented 3 years ago

Code with multiple output modules are already in the master branch. List of binaries are defined in src/Makefile.am.

I would favor completely independent binaries, because the two modes are not compatible. Once started with compact mode you can not switch to log-mode or vice versa.