I've written down a simple yet a bit obfuscated perl script to put samba logs on a MySQL database, inspired on a little howto i found some time ago googleing around. It works by reading logs from a fifo instead of parsing actual log files, but allows to create sparse files too. Log lines are then parsed by matching to a regexp to extract desired values then inserting the record on mysql. It should be pretty configurable, it can work as a daemon and is compatible with start-stop-daemon, but has not yet undergone much testing. You can get it at http://www.rovira.cat/gpl/samba-logger.pl Read the source code for docs. Any feedback is welcome. Quim Rovira
Funny, just 15 minutes ago I was thinking "I need to setup logging to dump into a database." I'll check it out soon and give it a test run. Thanks for answering my thoughts. Quim Rovira wrote:> I've written down a simple yet a bit obfuscated perl script to put > samba logs on a MySQL database, inspired on a little howto i found > some time ago googleing around. > It works by reading logs from a fifo instead of parsing actual log > files, but allows to create sparse files too. Log lines are then > parsed by matching to a regexp to extract desired values then > inserting the record on mysql. > > It should be pretty configurable, it can work as a daemon and is > compatible with start-stop-daemon, but has not yet undergone much > testing. > > You can get it at http://www.rovira.cat/gpl/samba-logger.pl > > Read the source code for docs. > > Any feedback is welcome. > > Quim Rovira
I've released a new version of the samba-logger script so it can support multiple matching criteria as well as logging to different mysql tables. Now it does all we need in our particular case, but any feedback or suggestions are welcome. You can find it at http://www.rovira.cat/gpl/samba-logger.tar.gz Quim Rovira. On 11/17/06, Quim Rovira <quim.rovira@gmail.com> wrote:> I've written down a simple yet a bit obfuscated perl script to put > samba logs on a MySQL database, inspired on a little howto i found > some time ago googleing around. > It works by reading logs from a fifo instead of parsing actual log > files, but allows to create sparse files too. Log lines are then > parsed by matching to a regexp to extract desired values then > inserting the record on mysql. > > It should be pretty configurable, it can work as a daemon and is > compatible with start-stop-daemon, but has not yet undergone much > testing. > > You can get it at http://www.rovira.cat/gpl/samba-logger.pl > > Read the source code for docs. > > Any feedback is welcome. > > Quim Rovira >