Closed edfletcher closed 7 months ago
Initial support landed with https://github.com/nhexirc/nhex/commit/b323a4cc6f1bbec9144307a1a99a2450b619884c
I considered adding a "plaintext" parallel mode but then realized it's completely unnecessary with the full-fidelity SQLite capture, because you can very easily produce such a log (including network and timestamp info) with something as simple as:
$ sqlite3 nhex.sqlite3 'select raw, network, time_unix_ms from logging;'
:tungsten.libera.chat NOTICE * :*** Checking Ident|irc.libera.chat|1713840183987
:tungsten.libera.chat NOTICE * :*** Looking up your hostname...|irc.libera.chat|1713840184183
:tungsten.libera.chat NOTICE * :*** Found your hostname: REDACTED|irc.libera.chat|1713840185607
:tungsten.libera.chat 001 ed-on-nhex :Welcome to the Libera.Chat Internet Relay Chat Network ed-on-nhex|irc.libera.chat|1713840190697
:tungsten.libera.chat 005 ed-on-nhex DEAF=D TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,agjrxz :are supported by this server|irc.libera.chat|1713840190697
:tungsten.libera.chat 251 ed-on-nhex :There are 70 users and 33589 invisible on 28 servers|irc.libera.chat|1713840190697
...
Furthermore, customizing that resulting plaintext log is also extremely simple. As CSV? Sure!
$ sqlite3 -csv nhex.sqlite3 'select raw, network, time_unix_ms from logging;'
Want only the raw lines from just Libera? Why not?!
$ sqlite3 nhex.sqlite3 "select raw from logging where network = 'irc.libera.chat';"
Only the actual chat (PRIVMSG
) messages? You got it!!
$ sqlite3 nhex.sqlite3 "select raw, network, time_unix_ms from logging where command = 'PRIVMSG';"
How about all the messages in which you were highlighted? Of course we can!
$ sqlite3 nhex.sqlite3 "select raw, network, time_unix_ms from logging where highlighted_us = 1;"
(Should probably add something like that 👆 to the docs...)
For the record, I'm not certain how it'll perform, but running multiple instances (to connect to multiple networks) may see write contention to the database, meaning not everything would be logged correctly.
I considered having separate DBs for each network (plus another for general user data, e.g. the /ignore table), but I dislike this for a couple reasons:
I'd prefer it be done in a structured way (such as SQLite), but am open to discussions.
For reference, I use SQLite as the logging persistence in DRC and it's fantastic: searching logs with SQL is a huge boon.