Add: installation de Goaccess sur NixOs
This commit is contained in:
parent
90e8b8ed21
commit
e7bd1de251
2 changed files with 166 additions and 0 deletions
84
content/posts/installation-goaccess-nixos.en.md
Normal file
84
content/posts/installation-goaccess-nixos.en.md
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
+++
|
||||
date = '2025-10-06T01:00:51+02:00'
|
||||
title = 'Goaccess install on NixOs'
|
||||
tags = [ "nixos","statistics" ]
|
||||
+++
|
||||
|
||||
When you self-host, there comes a moment when curiosity takes over.
|
||||
Who visits my site? At what time? Which pages actually get attention?
|
||||
|
||||
And, sooner or later, the big question:
|
||||
Is anyone, anywhere, really reading what I write?
|
||||
|
||||
You could go for Google Analytics or Matomo — but that comes with its own baggage:
|
||||
- Questionable privacy practices,
|
||||
- Third-party scripts injected into your site,
|
||||
- Extra weight on every page,
|
||||
- And a dependency on services I don’t want.
|
||||
|
||||
GoAccess, on the other hand, takes the minimalist route.
|
||||
No scripts, no tracking, no cookie banner — it reads directly from the web server logs (in my case, Caddy) and generates a clear, efficient report.
|
||||
|
||||
That’s the kind of philosophy I like:
|
||||
- Privacy-friendly — nothing leaves my server, no profiling.
|
||||
- Simple — I don’t touch my site, I just process the logs.
|
||||
- Fast — one command and I instantly see who visited and how.
|
||||
- Self-hosting friendly — no database, no bloated setup.
|
||||
|
||||
In short, GoAccess fits perfectly with what I look for in my homelab:
|
||||
|
||||
→ Getting visibility into my services without turning it into a Rube Goldberg machine.
|
||||
|
||||
⸻
|
||||
|
||||
Minimal setup on NixOS
|
||||
|
||||
GoAccess is available directly from the official repository.
|
||||
I just added the package and a small systemd service to generate a static report every hour:
|
||||
|
||||
```
|
||||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
goaccess
|
||||
];
|
||||
|
||||
# Service for generation the GoAccess static report
|
||||
systemd.services.goaccess-report = {
|
||||
description = "Generate GoAccess HTML report";
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.goaccess}/bin/goaccess /var/log/caddy/access-levr.porzh.me.log --log-format=CADDY -o /var/www/goaccess/index.html";
|
||||
};
|
||||
};
|
||||
|
||||
# Timer to regénérate the report every hour
|
||||
systemd.timers.goaccess-report = {
|
||||
description = "Hourly GoAccess report generation";
|
||||
wantedBy = ["timers.target"];
|
||||
timerConfig = {
|
||||
OnCalendar = "hourly";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
services.caddy = {
|
||||
virtualHosts = {
|
||||
"koum.porzh.me" = {
|
||||
extraConfig = ''
|
||||
root * /var/www/goaccess
|
||||
file_server browse
|
||||
try_files {path} {path}/ /index.html
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
What’s next?
|
||||
|
||||
In the second part, I’ll go a bit further:
|
||||
- filtering out local network IPs,
|
||||
- generating daily, weekly, and monthly reports,
|
||||
- and explaining why I chose not to use the “live” mode.
|
||||
|
||||
Because yes — even analytics deserve a bit of restraint.
|
||||
82
content/posts/installation-goaccess-nixos.fr.md
Normal file
82
content/posts/installation-goaccess-nixos.fr.md
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
+++
|
||||
date = '2025-10-06T01:00:51+02:00'
|
||||
title = 'Installation de goaccess sur NixOs'
|
||||
tags = [ "nixos","statistiques" ]
|
||||
+++
|
||||
|
||||
Quand on auto-héberge, il y a un moment où la curiosité prend le dessus.
|
||||
Qui visite mon site ? À quelle heure ? Quelles pages intéressent vraiment ?
|
||||
Et la question qu’on se pose tôt ou tard : est-ce que quelqu’un, quelque part, lit vraiment ce que j’écris ?
|
||||
|
||||
On peut se tourner vers Google Analytics ou Matomo, mais ça vient avec son lot de complications :
|
||||
- Respect de la vie privée discutable,
|
||||
- Scripts tiers à injecter dans le site,
|
||||
- Poids supplémentaire sur chaque page,
|
||||
- Et une dépendance à des services dont je ne veux pas.
|
||||
|
||||
GoAccess, lui, c’est un peu la voie minimaliste.
|
||||
Pas de scripts, pas de traçage, pas de cookie banner : il lit **directement les logs du serveur web** (dans mon cas, Caddy) et me génère un rapport clair et efficace.
|
||||
|
||||
C’est la philosophie qui me plaît :
|
||||
- **Respectueux de la vie privée** : rien ne sort de mon serveur, aucun profilage.
|
||||
- **Simple** : je ne change rien à mon site, je traite juste mes journaux de logs.
|
||||
- **Rapide** : une commande, et j’ai une vue immédiate sur qui est passé et comment.
|
||||
- **Self-hosting friendly** : pas besoin d’une base de données ni d’un monstre à maintenir.
|
||||
|
||||
En gros, GoAccess répond parfaitement à ce que je cherche dans mon homelab :
|
||||
|
||||
→ Avoir de la visibilité sur mes services **sans transformer ça en usine à gaz**.
|
||||
|
||||
## Mise en place minimale sous NixOS
|
||||
|
||||
GoAccess est disponible directement via le dépôt officiel.
|
||||
J’ai ajouté le paquet et un petit service systemd pour générer un rapport statique toutes les heures :
|
||||
|
||||
```
|
||||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
goaccess
|
||||
];
|
||||
|
||||
# Service pour générer le rapport statique GoAccess
|
||||
systemd.services.goaccess-report = {
|
||||
description = "Generate GoAccess HTML report";
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.goaccess}/bin/goaccess /var/log/caddy/access-levr.porzh.me.log --log-format=CADDY -o /var/www/goaccess/index.html";
|
||||
};
|
||||
};
|
||||
|
||||
# Timer pour régénérer le rapport toutes les heures
|
||||
systemd.timers.goaccess-report = {
|
||||
description = "Hourly GoAccess report generation";
|
||||
wantedBy = ["timers.target"];
|
||||
timerConfig = {
|
||||
OnCalendar = "hourly";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
services.caddy = {
|
||||
virtualHosts = {
|
||||
"koum.porzh.me" = {
|
||||
extraConfig = ''
|
||||
root * /var/www/goaccess
|
||||
file_server browse
|
||||
try_files {path} {path}/ /index.html
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Et la suite ?
|
||||
|
||||
|
||||
|
||||
Dans la deuxième partie, je montrerai comment aller plus loin :
|
||||
- filtrer les IP du réseau local,
|
||||
- générer des rapports **quotidiens, hebdomadaires et mensuels**,
|
||||
- et pourquoi j’ai décidé de **ne pas** utiliser le mode “live”.
|
||||
Parce que oui, même les stats méritent un peu de sobriété.
|
||||
Loading…
Add table
Add a link
Reference in a new issue