Пример #1
0
def url_hits():
    patterns = fetch_dynamic_patterns(app.config["URL_PATTERNS_FILE"])
    logs = fetch_logs(app.config["LOG_FILE_TO_ANALYZE"])
    urlhits = sorted(
        [(k[1], v) for k, v in logan.dynamic_urls(logs, patterns).iteritems()], key=lambda x: x[1], reverse=True
    )[:20]
    cache.set("url_hits", dict(urlhits), timeout=60 * 60)
Пример #2
0
def browsers():
    logs = fetch_logs(app.config["LOG_FILE_TO_ANALYZE"])
    browser_stats = sorted(
        [(k, v) for k, v in log_uagents.browsers(logs).iteritems()], key=lambda x: x[1], reverse=True
    )
    cache.set("browsers", dict(browser_stats), timeout=60 * 60)