Overview
| Comment: | fixed some errors |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
38f9c11f971a285fdb3573f163cfbad4 |
| User & Date: | c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 on 2009-10-02 15:00:43.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
2009-10-05
| ||
| 11:25 | * added regexp logging and fixed processing records with regexps; * added simple documentation and sample config file; * file renamed to match contents. check-in: d500448801 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
|
2009-10-02
| ||
| 15:00 | fixed some errors check-in: 38f9c11f97 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
| 14:19 | moving logging configuration to log added regexp supports - needs testing check-in: 7d9c268669 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk | |
Changes
Modified squid-tagger
from [33d38d1923]
to [7b0f96d40f].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | - + |
#!/usr/bin/env python3.1
import configparser, optparse, os, postgresql.api, re, sys, _thread
class Logger:
__slots__ = frozenset(['_silent', '_syslog'])
def __init__(self):
config.section('log')
|
| ︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - - - - - | config['database'], ) ) return(self._db) def check(self, ip_address, site): result = self._check_stmt(site, ip_address) if len(result) > 0: |
| ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | + + + + + + - - + + - + |
if len(self._queue) > 1 and self._lock.locked():
self._lock.release()
req = self._queue.pop(0)
self._lock_queue.release()
self._log.info('trying %s\n'%req[1])
row = self._db.check(req[2], req[1])
if row != None and row[0] != None:
if row[1] != None:
if re.compile(row[1]).match(req[3]):
writeline('%s 302:%s\n'%(req[0], row[0]))
else:
writeline('%s -\n'%req[0])
writeline('%s 302:%s\n'%(req[0], row[0]))
else:
writeline('%s -\n'%req[0])
def check(self, line):
request = re.compile('^([0-9]+)\ (http|ftp):\/\/([-\w.:]+)\/([^ ]*)\ ([0-9.]+)\/(-|[\w\.]+)\ (-|\w+)\ (-|GET|HEAD|POST).*$').match(line)
if request:
id = request.group(1)
site = request.group(3)
|
| ︙ |