= IRC Logs Plugin = == Description == Display logs of an IRC channel in trac == Bugs/Feature Requests == Existing bugs and feature requests for IrcLogsPlugin are [query:status!=closed&component=IrcLogsPlugin&order=priority here]. If you have any issues, create a [/newticket?component=IrcLogsPlugin&owner=pacopablo new ticket]. == Download and Source == Download the [download:irclogsplugin zipped source], check out [/svn/irclogsplugin using Subversion], or [source:irclogsplugin browse the source] with Trac. == Installation == Run "easy_install http://trac-hacks.org/svn/irclogsplugin/0.10/" for 0.10.4 trac installations (not supported) Run "easy_install http://trac-hacks.org/svn/irclogsplugin/0.11/" for 0.11+ trac installations Run "easy_install http://trac-hacks.org/svn/irclogsplugin/parsing_refactor/" for cutting edge beta version (0.11+ trac) The IrcLogsPlugin 0.11 depends on the http://swapoff.org/wiki/pyndexter python indexer. The beta version doesn't require pyndexter, but it will be needed for search capability. (It is installed automatically by easy_install) == Configuration 0.11 == In your trac.ini file add these: Under [Components], add: {{{ irclogs.irclogsplugin = enabled }}} Under [irclogs], add: {{{ path = /path/to/log/file/ChannelLogger indexer = builtin:///var/www/trac/indexer/irclogs.idx?cache=true prefix = #roomname }}} For 0.11 add this to [irclogs]: {{{ path = /path/to/log/file/ChannelLogger indexer = builtin:///var/www/trac/indexer/irclogs.idx?cache=true file_format = #roomname.%Y%m%d.log navigation_button = irclogs }}} This module was written assuming the use of [http://supybot.com/ supybot] logs. You will need to configure your supybot to output in the correct format (these are not the default for supybot): {{{ config supybot.log.timestampformat %Y-%m-%d %H:%M:%S | config supybot.plugins.channellogger true config supybot.plugins.channellogger.directories false config supybot.plugins.channellogger.filenametimestamp %Y%m%d config supybot.plugins.channellogger.rotatelogs true }}} The 0.11 version of the plugin expects a different `timestampformat`: {{{ config supybot.log.timestampformat %Y-%m-%dT%H:%M:%S }}} To (re)index your log files, use this [attachment:"indexer.py" pydexter indexing python script]. Be sure to edit the two variables for file locations in the script. '''Note:''' In order to enable indexing for 0.11, you'll currently need a patch, see comment:ticket:1183:6. == Configuration beta == === Quick Config === It is extremely simple to setup irclogs with supy bot. Just make sure the user running the trac process has access to the log files. {{{ [components] irclogs.* = enabled [irclogs] channel = #trac basepath = /var/logs/supybot/irclogs }}} === Verbose Config === Here is an example with a lot more options set. {{{ [irclogs] channel = #trac network = FreeNode basepath = /var/log/supybot/irclogs # ConfigParser braindamage workaround, see below # path is what we are trying to set. dateform = %%Y-%%m-%%d paths = %%(channel)s/%%(channel)s-%(dateform)s.log # done braindamage. navbutton = trac irc logs format = supy # gozer is also supported out of the box. hidden_users = billy-joe, mac provider = file timezone = UTC }}} ''There is a bug in ConfigParser that causes string interpolation, even though parameters are excaped, it in values with %%(named)s variables and date format (%%Y.. etc) variables. We require this functionality in the path option, so we have to split it into two variables to work around the issue. Normally the path default is fine and shouldn't be overridden, but if the need arises, this workaround will be needed.'' === DB Config === The database should take a standard trac db connection string. If none is specified, then the trac db will be used as the default. The database must contain a table with the following columns (time, network, target, nick, type, message). It is suggested that indexes are put on the time, (network, target) sets. target is usually the channel name. {{{ [irclogs] provider = db database = sqlite:/var/lib/gozerbot/.gozerbot/chatlog.db channel = #trac timezone = America/New_York }}} === Multi Channel Config === IrcLogPlugin now supports mutliple channels. Simple setup new channel options with the channel.$channel-name prefix. channel-name can be anything you like. Each channel will 'inherit' any unspecified options from the 'default' set of options. {{{ [irclogs] channel.gozer.channel = #dunkbots channel.gozer.format = gozer channel.gozer.timezone = America/New_York channel.gozer.navbutton = gozerbot irc logs channel.gozer.network = IrcNet channel.gozer.provider = file }}} === Adding New File Formats === The simplest way is to create a ticket and let me do it ;). But any help is much appreciated. A file format basically consists of file paths, regexes to parse lines, and order to try regexes in. match_order is the order the regexes will be matched in. The first part of the name will be matched to match_order. the match order value will also be used as the type. It is possible to add new types by having new regexes, but make sure there is a message positional regex group or things could go haywire. The timestamp regex is seperate for convenience. The timestamp format is used to parse the timestamp into a datetime. Here is an example for gozer (already provided by default).: {{{ format.gozer.basepath = /var/lib/gozerbot/.gozerbot/logs/ # the workaround again :P gozerdate = %%Y%%m%%d format.gozer.path = %%(network)s/simple/%%(channel)s.%(gozerdate).log format.gozer.timestamp_format = %%Y%%m%%d %%H%%M%%S format.gozer.timezone = utc format.gozer.timestamp_regex = (?P\d{4}-\d{2}-\d{2}.\d{2}:\d{2}:\d{2}) format.gozer.comment_regex = ^%%(timestamp_regex)s[ |:]*(?P<(?P[^>]+)>\s(?P.*))$ format.gozer.action_regex = ^%%(timestamp_regex)s[ |:]*(?P\*\s(?P[^ ]+)\s(?P.*))$ format.gozer.join_regex = ^%%(timestamp_regex)s[ |:]*(?P\*{0,3}\s(?P[^ ]+)\shas\sjoined.*)$ format.gozer.part_regex = ^%%(timestamp_regex)s[ |:]*(?P\*{0,3}\s(?P[^ ]+).*\shas\sleft.*)$ format.gozer.quit_regex = ^%%(timestamp_regex)s[ |:]*(?P\*{0,3}\s(?P[^ ]+).*\shas\squit.*)$ format.gozer.kick_regex = ^%%(timestamp_regex)s[ |:]*(?P\*{0,3}\s(?P[^ ]+)\swas\skicked\sby\s(?P[^ ]+).*)$ format.gozer.mode_regex = ^%%(timestamp_regex)s[ |:]*(?P\*{0,3}\s(?P[^ ]+)\ssets\smode:\s(?P.+))$ format.gozer.topic_regex = ^%%(timestamp_regex)s[ |:]*(?P\*{0,3}\s(?P[^ ]+)\schanges\stopic\sto\s"?(?P.+)"?)$ format.gozer.nick_regex = ^%%(timestamp_regex)s[ |:]*s(?P\*{3}\s(?P.*)\s.*now\sknown\sas(?P.*))$ format.gozer.notice_regex = ^%%(timestamp_regex)s[ |:]*s(?P-(?P.*)-\s(?P.*))$ format.gozer.match_order = comment part join quit action kick mode topic nick notice }}} == Wiki Macros 0.11 == === Quote === Show conversation excerpts from IRC logs: {{{ [[IrcLogQuote(UTC2008-02-11T18:03:27,5)]] }}} This macro takes two arguments: a UTC date formatted to ''UTCYYYY-MM-DDTHH:MM:SS'', and (optional) the number of lines to display relative to the first message. === Trac Links === Link to an IRC conversation: {{{ [irclog:UTC2008-02-11T18:03:27 View this conversation] }}} === "Live" Log === Show a "live" AJAX log display. '''Note:''' This macro should be used sparingly; it should not be on the front page of a project in most cases. {{{ [[IrcLogLive]] }}} This macro optionally takes two arguments: the first argument is the polling frequency in seconds (default is 60), the second argument is the number of lines to display (default is 10). {{{ [[IrcLogLive(60,10)]] }}} == Recent Changes == [[ChangeLog(irclogsplugin, 3)]] == Author/Contributors == '''Maintainer:''' [wiki:doki_pen][[br]] '''Author:''' [wiki:mitsuhiko] [[BR]] '''Contributors:''' [wiki:pacopablo] == Comments == {{{ [23:42] Someone know the IRCLogs plugin ? [23:43] (and have some info about it... nothing interresting on the wiki page...) Should the log be available before processing ? or Does the plugin connect to some channels ? [23:43] Rica|Coding: it just renders logs [23:43] specifically supy bot logs [23:44] ^^ok [23:44] you'll need a bot to creat the logs before the plugin is sueful }}}