Пример #1
0
def log_lighttpd():
    format = r'%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"'
    p = apachelog.parser(format)
    data = []
    for line in open('access.log'):
        try:
           data.append(p.parse(line))
        except:
           pass
    return jsonify(data=data)
Пример #2
0
 def from_log(self):
     format = r'%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"'
     p = apachelog.parser(format)
     data = []
     with open('access.log') as f:
         for line in f:
             try:
                 data.append(p.parse(line))
             except:
                 pass
     return jsonify(data=data)