A multi-language GoAccess web analytics dashboard and live language switcher for KeyHelp domains. It generates per-domain HTML reports with a searchable domain sidebar, persists GoAccess databases across runs, and switches report languages on the fly via a systemd path/service watcher (goaccess-lang.path / goaccess-lang.service) and a session/CSRF-protected PHP endpoint (gen-lang.php).
Important
Requirements
- Server: Debian/Ubuntu Linux server with
rootSSH access,systemd,bash, andlocale-gen. - GoAccess:
goaccessinstalled on the system (see Step 1). - KeyHelp: A dedicated subdomain or domain in KeyHelp (e.g.
stats.example.com) serving the generated HTML reports, plus/var/lib/goaccess-dbadded to PHPopen_basedir. - Permissions: Repository files under
/home/keyhelp/www/keyhelp/dashboard-layoutare automatically set tokeyhelp:keyhelpat the start of./install.
- Automatically discovers all active domains with access logs under
/home/users/<KH_USER>/logs/and generates individual HTML reports (<domain>.html). - Version check under sidebar buttons (
#custom-version-boxindashboard-inject.js) comparing the localVERSIONagainst the Git branch (main) with a 6-hourlocalStoragecache (no GitHub releases required). - Injects a fixed, searchable domain navigation sidebar (
Domains (A–Z)) and a live language selector (#custom-lang-select) into every generated report, keeping the selected language synced across reloads. - Supports 12 languages (
de,en,es,fr,it,ja,ko,pt,ru,sv,uk,zh) via UTF-8 system locales and stores the active language in/var/lib/goaccess-db/.current_langso scheduled cron runs keep your selected language. - Asynchronous report regeneration via
/var/lib/goaccess-db/.lang_requestandgoaccess-lang.pathwithflocklocking, a progress ring overlay, and a built-in log viewer (log-view.php). - Hardened
gen-lang.phpendpoint requiring an active KeyHelp session cookie, same-origin request headers, and a validX-CSRF-Token. - Multi-user capable via separate
*.conffiles in/home/keyhelp/www/keyhelp/dashboard-layout/goaccess/.
dashboard-layout/goaccess/
├── README.md # Full installation and usage documentation
├── VERSION # Current dashboard version used for Git branch update checks
├── .gitignore # Ignores local *.conf files while keeping *.conf.example
├── goaccess.conf.example # Template for per-user configuration (<user>.conf)
├── install # Interactive installer (permissions, locales, dirs, scripts, systemd, cron)
├── uninstall # Removes systemd units, cronjob, /usr/local/bin/ scripts and generated files
├── update-goaccess.sh # Generates HTML reports across *.conf files, mirrors logs & injects UI
├── goaccess-lang-runner.sh # Systemd runner with flock locking and trigger cleanup
├── goaccess-lang.path # Systemd path unit watching .lang_request
├── goaccess-lang.service # Systemd oneshot service running update-goaccess.sh
├── gen-lang.php # Session, same-origin & CSRF-protected trigger endpoint
├── log-view.php # Session-protected log viewer endpoint for update logs
├── login.php # Authentication gate for the statistics subdomain
└── assets/
└── dashboard-inject.js # Client-side language dropdown, progress overlay & CSRF logic
- Log in to your KeyHelp panel.
- Go to Domains -> Add Domain (or Subdomains -> Add Subdomain) and create a dedicated subdomain for your analytics dashboard, for example
stats.example.com, assigned to the target KeyHelp user (e.g.exampleuser). - Enable Let's Encrypt SSL for
stats.example.comso the dashboard and PHP session cookies work over HTTPS.
gen-lang.php writes the language trigger file /var/lib/goaccess-db/.lang_request so systemd can regenerate reports as root. PHP must be allowed to access /var/lib/goaccess-db:
- In KeyHelp, open Users and click Edit on the KeyHelp user that owns
stats.example.com. - Switch to the PHP tab.
- Locate the
open_basedirfield and append:/var/lib/goaccess-dbto the existing path list (e.g.##DOCROOT##/www:##DOCROOT##/files:##DOCROOT##/tmp:/var/lib/goaccess-db). - Click Save.
Clone or pull https://github.com/NicoMSH-plugins/KeyHelp-GoAccess-Multi-Language into /home/keyhelp/www/keyhelp/dashboard-layout/goaccess:
If /home/keyhelp/www/keyhelp/dashboard-layout/goaccess does not exist yet:
mkdir -p /home/keyhelp/www/keyhelp/dashboard-layout
cd /home/keyhelp/www/keyhelp/dashboard-layout
git clone https://github.com/NicoMSH-plugins/KeyHelp-GoAccess-Multi-Language.git goaccess
cd goaccess
chmod +x /home/keyhelp/www/keyhelp/dashboard-layout/goaccess/install /home/keyhelp/www/keyhelp/dashboard-layout/goaccess/uninstallIf /home/keyhelp/www/keyhelp/dashboard-layout/goaccess already exists, pull or check out into it:
cd /home/keyhelp/www/keyhelp/dashboard-layout/goaccess
if [ -d .git ]; then
git pull --ff-only origin main
else
git init -b main
git remote add origin https://github.com/NicoMSH-plugins/KeyHelp-GoAccess-Multi-Language.git
git fetch origin main
git reset --hard origin/main
fi
chmod +x /home/keyhelp/www/keyhelp/dashboard-layout/goaccess/install /home/keyhelp/www/keyhelp/dashboard-layout/goaccess/uninstallVerify that the files are present:
ls -la /home/keyhelp/www/keyhelp/dashboard-layout/goaccessRun ./install as root. It sets directory ownership to keyhelp:keyhelp right at startup, guides you interactively through user/domain setup, domain filters, cron interval, and login credentials, and generates the initial reports:
cd /home/keyhelp/www/keyhelp/dashboard-layout/goaccess
chmod +x install uninstall
./installThe installer automatically:
- Sets
keyhelp:keyhelpownership on the GoAccess directory and marks scripts executable. - Enables and generates the required UTF-8 locales in
/etc/locale.gen. - Creates
/var/lib/goaccess-db/<user>with permissions for<user>:www-data. - Installs
update-goaccess.shandgoaccess-lang-runner.shto/usr/local/bin/. - Installs and enables
goaccess-lang.pathandgoaccess-lang.service. - Generates the initial HTML reports and sets up the root cronjob (with a custom minute interval and confirmation prompt).
- Configures
login.php,log-view.php,gen-lang.php,.htaccess, and.htpasswdin your statistics webroot (OUT_DIR).
Note
Supporting Multiple KeyHelp Users & Custom Document Root: You can add additional users directly via the installer prompt when re-running ./install. By default, OUT_DIR is /home/users/<KH_USER>/www/<STATS_DOMAIN> – if your subdomain in KeyHelp uses a custom document root path, update OUT_DIR in <user>.conf and run ./install again.
Check that goaccess-lang.path, the root cronjob, and the generated HTML reports are in place:
systemctl is-active goaccess-lang.path
crontab -l | grep update-goaccess.sh
ls -la /home/users/<KH_USER>/www/<STATS_DOMAIN>/*.html- Make sure you have an active session in your KeyHelp panel (so your browser holds a valid KeyHelp session cookie for CSRF-protected language switching).
- Open your statistics subdomain in the browser by navigating directly to one of your generated domain reports:
https://stats.example.com/<your-domain.tld>.html - Use the left sidebar (
Domains (A–Z)) and the search input (Domain suchen...) to switch between all analyzed domains. - Use the language dropdown in the top-right corner of the sidebar to switch the report language. A progress ring overlay appears while
systemdregenerates all reports in the selected language, and the page reloads automatically once finished. You can also open the update log anytime via Log anzeigen.
Updates can be triggered directly from the Update button in the bottom-left sidebar of your statistics dashboard whenever a new release is available. The background runner automatically pulls the latest changes from main, updates scripts, PHP endpoints, systemd units, GeoIP data, and GoAccess 1.12 if needed, rebuilds all reports, and logs every step in the Log Viewer (local *.conf files remain untouched).
To stop and remove the systemd units, cronjob, helper scripts under /usr/local/bin/, and generated files:
cd /home/keyhelp/www/keyhelp/dashboard-layout/goaccess
./uninstallShow / Expand Changelog History
- Horizontal & Wide-View Layout Offset Fix: Added dynamic sidebar offset calculation (
--ga-nav-offsetviaResizeObserverand viewport resize listener indashboard-inject.js) with horizontal overflow handling so wide GoAccess report columns and panels are no longer clipped on the left. - Restored Sidebar Self-Update Button: Removed a duplicate
const updBtndeclaration indashboard-inject.jsthat prevented the injected script block from executing and rendering the update trigger button.
- Automatic GeoIP City Map (No Registration Required): Automatically downloads and refreshes
GeoLite2-City.mmdbunder/usr/share/GeoIP/GeoLite2-City.mmdb(every 30 days viaupdate-goaccess.shand during./install) from a public mirror without requiring a MaxMind account, passing--geoip-databaseto GoAccess so the Geo Location world map and city markers render automatically.
- Non-Interactive Install & Cleanup: Updated
installanduninstallfor reliable, non-interactive execution including full cleanup of/usr/local/bin/goaccessand/usr/share/GeoIP/GeoLite2-City.mmdb. - Layout & Sidebar Alignment: Refined offset handling in
assets/dashboard-inject.jsacross the custom domain sidebar, navigation icon bar, and main report container. - Granular Update Logging: Expanded
log_msgoutput inupdate-goaccess.shso domain runs, log counts, and status entries appear completely ingoaccess-update.logand the Log Viewer. - Auto-Update Step Logging: Added detailed
[AUTO-UPDATE]step logging (Git pull with commit hash, file sync, GeoIP check, GoAccess binary check, and user log synchronization) ingoaccess-lang-runner.shso automated UI updates remain fully visible in the Log Viewer. - Automated Runner Upgrades: Extended
goaccess-lang-runner.shto sync/usr/local/bin/VERSION, ensureGeoLite2-City.mmdbis present, restartgoaccess-lang.path, and non-interactively build GoAccess1.9.4when needed.
- GoAccess 1.12 Source Build: Updated
installandgoaccess-lang-runner.shto build and upgrade GoAccess to1.12with--enable-utf8,--enable-geoip=mmdb, and--with-openssl(removing older apt-packagedgoaccessinstallations automatically). - Complete Uninstall Cleanup: Extended
uninstallto also remove/usr/local/etc/goaccessleft behind by source builds.
- Logrotate & Persistent Update Log History: Added automatic
/etc/logrotate.d/goaccess-updateconfiguration during./install(daily rotation, 3 compressed archives, proper file ownership) and updatedupdate-goaccess.shto append logs instead of truncatinggoaccess-update.logon every run (with cleanup in./uninstallandgoaccess-update.log*ignored in.gitignore). - Bash Test Modernization (
[[ ... ]]): Refactored conditional tests from[ ... ]to[[ ... ]]acrossinstall,uninstall,update-goaccess.sh, andgoaccess-lang-runner.shto comply with Bash best-practice and SonarQube quality rules.
- Multi-User Path & Logrotate Refactoring: Removed remaining hardcoded user and domain paths from
gen-lang.php,goaccess-lang-runner.sh, andinstallso progress polling, auto-update file/log synchronization, and/etc/logrotate.d/goaccess-updaterules are generated dynamically for all configured*.confusers. - Language Switcher Permission & Progress Reliability: Fixed
.lang_requestand.gen_progressownership and file mode handling (0664/0660instead of0666) across PHP and the systemd path runner so language switching works cleanly without permission errors.