htcount-0.3.0 is not a library.
htcount
Simple CLI/daemon tool for counting visitors using access.log
in the Common Log Format
Export totals in multiple formats, such as JSON or SVG badge!
Features
Export formats
- JSON - for API usage
- SVG - configurable or default badge button
Install
git clone https://github.com/YGGverse/htcount.git && cd htcount
cargo build --release
sudo install target/release/htcount /usr/local/bin/htcount
Usage
- see
default/counter.svg
Options
)
)
)
)
)
)
systemd
#/etc/systemd/system/htcount.service
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/htcount --source /var/log/nginx/access.log\
--target-svg /var/www/htcount/visitors.svg\
--template-svg /path/to/default/template.svg\
--ignore-host 127.0.0.1\
--ignore-host 127.0.0.2\
--match-time %%d/%%b/%%Y\
--update 3600\
--debug n
StandardOutput=null
StandardError=null
[Install]
WantedBy=multi-user.target
- make sure
/var/www/htcount
directory exists - replace
/path/to/default/template.svg
with your custom template path - use
ignore-host
to skip local host requests - to filter today-only records, use
match-time
argument%d/%b/%Y
- to filter this month-only records use
%b/%Y
- make sure the time pattern in the example above corresponds to your
access.log
format - make sure the log time pattern
%
is escaped to%%
- to filter this month-only records use
Service management tips
systemctl daemon-reload
- update configurationsystemctl enable
- launch on system startupsystemctl restart htcount
- start systemd servicesystemctl status htcount
- check if service is running