diff --git a/CHANGELOG.md b/CHANGELOG.md index 91fc2ed..8575178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,3 +2,4 @@ ## 0.1.0 - 12-7-24 - Intitial Release. +- Binaries compiled with Fedora 40 and Alpine Linux 3.20. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ed222ff --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# GoAccessReporter + +A small program for web hosts, or self hosters, that reads TOML config files (TOML v0.5.0 currently), generates reports with [GoAccess](https://goaccess.io/), and emails them to config'd recipients. The user can schedule with cron, systemd-timers, etc. Written and tested for linux. + +# System package dependencies +-- GoAccessReporter expects `GoAccess` to be installed and configured(working with your nginx log files), as well as `tar` being installed. + +# Building from source? +-- You will need Nim installed, which probably also contains Nimble, the Nim package manager. + +-- Install the non-stdlib dependencies: `nimble install parsetoml, smtp, mime` + +-- Compile goaccess_reporter.nim with: `nim c --d:threads:off -d:ssl -d:release goaccess_reporter.nim` + +# Or Just Download a binary +-- Download whichever binary you need from the `binaries` directory. The default binary is compiled for x86_64 GNU libc (in Fedora), and the other is compiled for x86_64 musl (in Alpine Linux). I will try to note the distros' versions in the CHANGELOGs for a given release, so users can gauge the compatibility of the binaries. + +# Configuration and use. +-- Copy the binary to `/usr/local/bin`, or wherever you prefer in your PATH on your server, and make it executable with `chmod +x goaccess_reporter_binary_name`. + +-- Create `/etc/goaccess-reporter` (dash, not underscore) and copy `example_config_files/email.toml` and `example_config_files/sites.toml` there and edit them for your needs. + +-- Run the program with cron by copying `example_config_files/run_goaccess_reporter.sh` to `/etc/periodic/monthly` on your server, or use whatever scheduling method you prefer. + +-- GoAccessReporter will create `~/.goaccess-reporter`, `~/.gooaccess-reporter/reports` and `~/.goaacess-reporter/goaccess-reporter.log` when it runs. If `delete-after = false` is set in `sites.toml` for a site, the report will be saved in the `reports` directory. + +# But Why? +Many website owners want some stats on page visits, referrering urls, etc., so they can gauge their SEO and marketing efforts, but adding analytics scripts to sites can slow them down, and/or turn them into third party spyware. GoAccess is FOSS (Free/Open Source Software) that simply parses the webserver log, and makes it available as a nice html report. GoAccessReporter allows web hosts to easily configure which sites GoAccess generates reports for, and then emails those reports to configured addresses. + +Enjoy! diff --git a/binaries/goaccess_reporter_0.1.0 b/binaries/goaccess_reporter_0.1.0 new file mode 100755 index 0000000..543077f Binary files /dev/null and b/binaries/goaccess_reporter_0.1.0 differ diff --git a/binaries/goaccess_reporter_0.1.0_alpine b/binaries/goaccess_reporter_0.1.0_alpine new file mode 100755 index 0000000..1be339f Binary files /dev/null and b/binaries/goaccess_reporter_0.1.0_alpine differ diff --git a/example_config_files/email.toml b/example_config_files/email.toml new file mode 100644 index 0000000..d2bc741 --- /dev/null +++ b/example_config_files/email.toml @@ -0,0 +1,5 @@ +[server] +hostname = "email.mydomain.org" +starttls-port = 587 +sender-address = "maileraddress@mydomain.org" +sender-password = "supersecretpassword" diff --git a/example_config_files/run_goaccess_reporter.sh b/example_config_files/run_goaccess_reporter.sh new file mode 100644 index 0000000..c1c5111 --- /dev/null +++ b/example_config_files/run_goaccess_reporter.sh @@ -0,0 +1,6 @@ +#! /bin/sh + +#the name of your compiled goaccess_reporter binary. +goaccess_reporter_0.1.0_alpine + +exit diff --git a/example_config_files/sites.toml b/example_config_files/sites.toml new file mode 100644 index 0000000..3037711 --- /dev/null +++ b/example_config_files/sites.toml @@ -0,0 +1,26 @@ +#name of the site. can company name, domain, whatever makes the most sense. +[site1] +#webserver log location. +log-file = "/var/www/www-logs/site1-access.log" +#where to save the report and how to name it. +output = "/home/myuser/.goaccess_reporter/site1-report.html" +#append date to report name. This prevents overwriting existing reports. IDK if i even tested with "append-date = false". +append-date = true +#delete saved report.html after tarballing and emailing it. +delete-after = true +#array/seq of email addresses to send the report to. +email-addresses = ["jack@site1.org", "jill@site1.org"] + +[site2] +log-file = "/var/www/www-logs/site2-access.log" +output = "/home/myuser/.goaccess_reporter/site2.html" +append-date = true +delete-after = false +email-addresses = ["john@site2.com", "jane@site2.com"] + +[site3] +log-file = "/var/www/www-logs/site3-access.log" +output = "/home/myuser/.goaccess_reporter/site3-report.html" +append-date = true +delete-after = true +email-addresses = ["admin@site3.org"]