wiki:IrcLogsPlugin

Version 27 (modified by figaro, 8 years ago) (diff)

Cosmetic changes

Display IRC logs

Notice: This plugin is unmaintained and available for adoption.

Description

This plugin displays logs of an IRC channel in Trac.

Key features:

  • Multi-channel support.
  • Javascript calendar provided by jquery-ui (much prettier).
  • Hard pyndexter dependency removed.
  • Out-of-the-box gozerbot support.
  • More flexible parser:
    • configuration based: add new formats with no code changes.
    • multi-file support: some loggers split logs into different files, gozerbot simple format for example.
  • Database backend support: look at the gozerbot chatlog plugin to create database irc logs.
  • Better timezone support, logs are displayed in the user's timezone.
  • Unit tests.

Known issues

  • Search is not functional yet.
  • Days without logs are no longer shaded in the calendar. This is because we are using the user's timezone and it's much harder to tell what days have logs without parsing each request. I hope to have some caching in the future that will allow this feature to come back. For most people it's not a problem, because there is at least one message in their irc channel every day.

Bugs/Feature Requests

Existing bugs and feature requests for IrcLogsPlugin are here.

If you have any issues, create a new ticket.

defect

7 / 14

enhancement

4 / 5

task

0 / 1

Download

Download the zipped source from here.

Source

Check out IrcLogsPlugin from here using Subversion, or browse the source with Trac.

Installation

Run easy_install https://trac-hacks.org/svn/irclogsplugin/0.10/ for 0.10.4 Trac installations (not supported).

Run easy_install https://trac-hacks.org/svn/irclogsplugin/0.11/ for 0.11+ Trac installations.

Run easy_install https://trac-hacks.org/svn/irclogsplugin/parsing_refactor/ for cutting edge beta version (0.11+ Trac).

The IrcLogsPlugin 0.11 depends on the 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:

[components]
irclogs.irclogsplugin = enabled
...
[irclogs]
path = /path/to/log/file/ChannelLogger 
indexer = builtin:///var/www/trac/indexer/irclogs.idx?cache=true
prefix = #roomname

For 0.11 add this:

[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 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 pyndexter indexing python script. Be sure to edit the two variables for file locations in the script.

Note: To enable indexing for 0.11, you'll need a patch, see comment:ticket:1183:6.

Configuration Beta

Quick Configuration

It is 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 Configuration

Here is an example with a lot more options set.

[irclogs]
channel = #trac
network = FreeNode
basepath = /var/log/supybot/irclogs
paths = %%(channel)s/%%(channel)s-%%Y-%%m-%%d.log
navbutton = trac irc logs
format = supy  # gozer is also supported out of the box.
hidden_users = billy-joe, mac
provider = file
timezone = UTC

Database Configuration

The database should take a standard Trac database connection string. If none is specified, then the Trac database 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 Configuration

IrcLogPlugin now supports multiple channels. Simply set up the new channel options with the channel.$channel-name prefix. The 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

A file format basically consists of file paths, regexes to parse lines, and order to try regexes in. The 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 separate 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/
format.gozer.path = %%(network)s/simple/%%(channel)s.%%Y%%m%%d.log
format.gozer.timestamp_format = %%Y%%m%%d %%H%%M%%S
format.gozer.timezone = utc
format.gozer.timestamp_regex = (?P<timestamp>\d{4}-\d{2}-\d{2}.\d{2}:\d{2}:\d{2})
format.gozer.comment_regex = ^%%(timestamp_regex)s[ |:]*(?P<message><(?P<nick>[^>]+)>\s(?P<comment>.*))$
format.gozer.action_regex  = ^%%(timestamp_regex)s[ |:]*(?P<message>\*\s(?P<nick>[^ ]+)\s(?P<action>.*))$
format.gozer.join_regex    = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+)\shas\sjoined.*)$
format.gozer.part_regex    = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+).*\shas\sleft.*)$
format.gozer.quit_regex    = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+).*\shas\squit.*)$
format.gozer.kick_regex    = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<kicked>[^ ]+)\swas\skicked\sby\s(?P<nick>[^ ]+).*)$
format.gozer.mode_regex    = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+)\ssets\smode:\s(?P<mode>.+))$
format.gozer.topic_regex   = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+)\schanges\stopic\sto\s"?(?P<topic>.+)"?)$
format.gozer.nick_regex    = ^%%(timestamp_regex)s[ |:]*s(?P<message>\*{3}\s(?P<nick>.*)\s.*now\sknown\sas(?P<newnick>.*))$
format.gozer.notice_regex  = ^%%(timestamp_regex)s[ |:]*s(?P<message>-(?P<nick>.*)-\s(?P<notice>.*))$
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.

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]]

Wiki Macros Beta

Trac Links

Link to an IRC conversation:

[irclog:trac-UTC2008-02-11T18:03:27 View this trac conversation]
[irclog:UTC2008-02-11T18:03:27 View this default conversation]

The format is (channel)-(timestamp). For the default channel, simply use timestamp. Timestamp is UTC date formatted to UTCYYYY-MM-DDTHH:MM:SS.

Quote

Show conversation excerpts from IRC logs:

[[IrcLogQuote(channel=trac, datetime=UTC2009-07-19T13:20:30, offset=3360)]]

channel is the default channel if none is specified. There may not be a default channel setup though.

UTC date formatted to UTCYYYY-MM-DDTHH:MM:SS, and (optional) offset, number of seconds to display.

"Live" Log

Show a "live" AJAX log display:

[[IrcLogLive]]

Note: This macro should be used sparingly; it should not be on the front page of a project in most cases.

This macro takes 3 optional arguments: poll_frequency (default is 60), count (default is 10) and channel (default is default):

[[IrcLogLive(channel=trac, poll_frequency=60, count=10)]]

Recent Changes

16464 by rjollos on 2017-04-04 07:26:28
Fix indentation
7149 by doki_pen on 2009-11-16 15:19:06
don't be an idiot.

only window.location.href = window.location.href if
there's a hash.

7103 by doki_pen on 2009-11-06 21:17:38
Added hash refresh after css loading
(more)

Author/Contributors

Author: mitsuhiko
Maintainer: none (needsadoption)
Contributors: pacopablo, jgoldberg

Comments

[23:42] <Rica|Coding> Someone know the IRCLogs plugin ?
[23:43] <Rica|Coding> (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] <pacopablo> Rica|Coding: it just renders logs
[23:43] <pacopablo> specifically supy bot logs
[23:44] <Rica|Coding> ^^ok
[23:44] <pacopablo> you'll need a bot to create the logs before the plugin is sueful

Attachments (1)

Download all attachments as: .zip