Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statistics #26

Open
Jasata opened this issue Dec 24, 2019 · 3 comments
Open

Statistics #26

Jasata opened this issue Dec 24, 2019 · 3 comments
Labels
deferred While this label is attached, do not start working on this issue feature request New feature or request

Comments

@Jasata
Copy link
Owner

Jasata commented Dec 24, 2019

Probably requires a cron job to process Nginx logs.

Wanted statistics:
download counts for each image, over weeks (1 - 52/53). Count unfinished downloads separately.

DO NOT IMPLEMENT BEFORE UPLOAD SOLUTION HAS BEEN COMPLETED AND TESTED! Download might also be changed into HTML5 API implementation, and if so, then the statistics need to be maintained and recorded into a database.

Leave this until the download mechanism is truly fixed!

@Jasata Jasata added feature request New feature or request deferred While this label is attached, do not start working on this issue labels Dec 24, 2019
@Jasata
Copy link
Owner Author

Jasata commented Sep 18, 2020

Download has been stable for half a year now.

What was drafted and how was it going to be implemented, has been forgotten. Reason why it is not included here, is that Ari/Timo team was looking into it and what exists, is somewhere in GitLab...

@Jasata
Copy link
Owner Author

Jasata commented Oct 19, 2020

Backend implementation started as a student project. Frontend is not currently tasked to anyone.

@Jasata
Copy link
Owner Author

Jasata commented Sep 22, 2021

Mona's version needs to be found... This also exists:

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Turku University (2019) Department of Future Technologies
#
# pal.py - Parse Access Log
#
#   0.1.0   2020.01.17  Initial version.
#
import os
import syslog
from datetime import datetime

LOGFILE = "vm.utu.fi.access.log.1"

syslog.openlog("access.log parser")
with open(LOGFILE, "r") as log:
    for line in log:
        try:
            item = line.split()
            if item[5] == '"GET' and item[6].startswith('/download/'):
                print(
                    datetime.strptime(
                        item[3][1:],
                        '%d/%b/%Y:%H:%M:%S'
                    ),
                    os.path.split(item[6])[1],
                    item[9]
                )
        except Exception as e:
            syslog.syslog("Rat bastards! Who screwed up the log format?")
            with open("troublemakers.log", "a") as trbl:
                trbl.write(line)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deferred While this label is attached, do not start working on this issue feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant