cybernetisk / internsystem-v2

A NextJS-based website. Used for public information about Cybernetisk Selskab, and necessary tools for volunteers at the bar/café Escape.
https://cyb.no
MIT License
7 stars 9 forks source link

Count redirects and subdomain visits #19

Open ubesluttsom opened 3 months ago

ubesluttsom commented 3 months ago

We could implement logging to capture and analyze requests made to specific subdomains on our website, such as cyb.no, bong.cyb.no, and oko.cyb.no. This will allow us to monitor which redirects and subdomains are actually in use (and remove those that are not).

We should count the number of requests made to each of these domains. For instance, using a grep command to filter the log file and wc -l to count the occurrences.

The logs need to be purged regularly.

We use Caddy as a web server. Something like this could work:

{
    # Global options
    log {
        output file /var/log/caddy/domain_specific.log
        format single_field "{host} {uri} {status}"
    }
}

bong.cyb.no, cyb.no, oko.cyb.no {
    # Specific configuration
    log {
        output file /var/log/caddy/domain_specific.log
        format "{host} {uri} {status}"
    }
}