| 67 | |
| 68 | == Configuration beta == |
| 69 | |
| 70 | === Quick Config === |
| 71 | |
| 72 | 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. |
| 73 | |
| 74 | {{{ |
| 75 | [components] |
| 76 | irclogs.* = enabled |
| 77 | |
| 78 | [irclogs] |
| 79 | channel = #trac |
| 80 | basepath = /var/logs/supybot/irclogs |
| 81 | }}} |
| 82 | |
| 83 | === Verbose Config === |
| 84 | |
| 85 | Here is an example with a lot more options set. |
| 86 | |
| 87 | {{{ |
| 88 | [irclogs] |
| 89 | channel = #trac |
| 90 | network = FreeNode |
| 91 | basepath = /var/log/supybot/irclogs |
| 92 | # ConfigParser braindamage workaround, see below |
| 93 | # path is what we are trying to set. |
| 94 | dateform = %%Y-%%m-%%d |
| 95 | paths = %%(channel)s/%%(channel)s-%(dateform)s.log |
| 96 | # done braindamage. |
| 97 | navbutton = trac irc logs |
| 98 | format = supy # gozer is also supported out of the box. |
| 99 | hidden_users = billy-joe, mac |
| 100 | provider = file |
| 101 | timezone = UTC |
| 102 | }}} |
| 103 | |
| 104 | ''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.'' |
| 105 | |
| 106 | === DB Config === |
| 107 | |
| 108 | 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. |
| 109 | |
| 110 | {{{ |
| 111 | [irclogs] |
| 112 | provider = db |
| 113 | database = sqlite:/var/lib/gozerbot/.gozerbot/chatlog.db |
| 114 | channel = #trac |
| 115 | timezone = America/New_York |
| 116 | }}} |
| 117 | |
| 118 | === Multi Channel Config === |
| 119 | |
| 120 | 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. |
| 121 | |
| 122 | {{{ |
| 123 | [irclogs] |
| 124 | channel.gozer.channel = #dunkbots |
| 125 | channel.gozer.format = gozer |
| 126 | channel.gozer.timezone = America/New_York |
| 127 | channel.gozer.navbutton = gozerbot irc logs |
| 128 | channel.gozer.network = IrcNet |
| 129 | channel.gozer.provider = file |
| 130 | }}} |
| 131 | |
| 132 | === Adding New File Formats === |
| 133 | |
| 134 | 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).: |
| 135 | |
| 136 | {{{ |
| 137 | format.gozer.basepath = /var/lib/gozerbot/.gozerbot/logs/ |
| 138 | # the workaround again :P |
| 139 | gozerdate = %%Y%%m%%d |
| 140 | format.gozer.path = %%(network)s/simple/%%(channel)s.%(gozerdate).log |
| 141 | format.gozer.timestamp_format = %%Y%%m%%d %%H%%M%%S |
| 142 | format.gozer.timezone = utc |
| 143 | format.gozer.timestamp_regex = (?P<timestamp>\d{4}-\d{2}-\d{2}.\d{2}:\d{2}:\d{2}) |
| 144 | format.gozer.comment_regex = ^%%(timestamp_regex)s[ |:]*(?P<message><(?P<nick>[^>]+)>\s(?P<comment>.*))$ |
| 145 | format.gozer.action_regex = ^%%(timestamp_regex)s[ |:]*(?P<message>\*\s(?P<nick>[^ ]+)\s(?P<action>.*))$ |
| 146 | format.gozer.join_regex = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+)\shas\sjoined.*)$ |
| 147 | format.gozer.part_regex = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+).*\shas\sleft.*)$ |
| 148 | format.gozer.quit_regex = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+).*\shas\squit.*)$ |
| 149 | format.gozer.kick_regex = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<kicked>[^ ]+)\swas\skicked\sby\s(?P<nick>[^ ]+).*)$ |
| 150 | format.gozer.mode_regex = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+)\ssets\smode:\s(?P<mode>.+))$ |
| 151 | format.gozer.topic_regex = ^%%(timestamp_regex)s[ |:]*(?P<message>\*{0,3}\s(?P<nick>[^ ]+)\schanges\stopic\sto\s"?(?P<topic>.+)"?)$ |
| 152 | format.gozer.nick_regex = ^%%(timestamp_regex)s[ |:]*s(?P<message>\*{3}\s(?P<nick>.*)\s.*now\sknown\sas(?P<newnick>.*))$ |
| 153 | format.gozer.notice_regex = ^%%(timestamp_regex)s[ |:]*s(?P<message>-(?P<nick>.*)-\s(?P<notice>.*))$ |
| 154 | format.gozer.match_order = comment part join quit action kick mode topic nick notice |
| 155 | }}} |