Skip to content
Docs / Install

Set up Pagereckon on an Apache server

Apache writes an access log line for each request, and Pagereckon reads those lines to count people, bots and AI crawlers. This guide covers the usual paths, the log format, file rights and rotation.

On your own server the setup takes about ten minutes. On shared hosting, the cPanel guide or the Plesk guide fits better.

The Pagereckon team Updated
Apache at a glance, from Pagereckon

Where Apache writes the access log

The CustomLog directive sets the file and the format. A path without a leading slash is relative to ServerRoot. Linux packages place the logs in a system folder, and the name depends on the distribution.

Access log paths the Find my log wizard checks for Apache
SystemPath
Debian, Ubuntu`/var/log/apache2/access.log`
Debian, Ubuntu (shared vhost log)`/var/log/apache2/other_vhosts_access.log`
Debian, Ubuntu (per site)`/var/log/apache2/example.com-access.log`
RHEL, Rocky, AlmaLinux`/var/log/httpd/access_log`
RHEL family (per site)`/var/log/httpd/example.com-access_log`
DirectAdmin`/var/log/httpd/domains/example.com.log`

To find the real file, search the config for CustomLog, for example with grep -ri customlog /etc/apache2/ or /etc/httpd/. Then take the path from the virtual host of your WordPress site.

Use the combined Apache LogFormat

Apache defines a format with the nickname combined. It adds the referrer and the user agent to the common format. Pagereckon needs both: the referrer shows where a visit came from, and the user agent names the bot or browser.

Apache config
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined

Pagereckon also reads the common format and JSON lines. Still, combined gives you the full report. If your virtual host uses a custom format, check that it keeps those two fields at the end.

Pick the Apache log in Find my log

First, download the free plugin, install it and activate it. Then open Pagereckon, Settings. The Find my log table lists the files PHP can read, the format of each, and a check mark when the lines belong to your site.

  1. Press Use this log next to the right file.
  2. If the file is missing, paste its path into Test a path.
  3. When the test passes, enter that path in Access log path(s) and save.

The test reads a short sample of lines from the file. It shows the format, how many lines it could read and one sample line with the IP hidden.

File rights for the PHP user

The Apache docs warn against letting other users write to the log folder, because that can give them root. Reading is a different matter. Pagereckon only needs read access, and it never writes to the log.

Many systems keep the log folder readable only by root and an admin group. So check with ls -ld and ls -l. Then give the PHP user read rights, for example through the group or an ACL. Also check open_basedir, since it can stop PHP before file rights even matter. The test tells you which of the two blocks the file.

Apache log rotation and .gz copies

Apache logs grow fast, so most systems rotate them. Some use the rotatelogs program through a piped log. Others use logrotate, with a config in /etc/logrotate.d/. After the move, Apache reopens its logs on a graceful restart.

Pagereckon notices when a file starts over and reads it again from the top. In addition, you can import past days with a pattern such as /var/log/apache2/access.log*. It reads rotated copies first, oldest first, and each .gz file only once. However, when logrotate creates the new file, it sets the rights again. So put the read rights in the logrotate config, too.

Cron job and the PHP fallback

WordPress cron runs the ingest every 10 minutes when the site gets visits. A real cron is steadier:

Server cron
*/5 * * * * wp --path=/var/www/example.com pagereckon ingest --max-seconds=240

If PHP can never read the log, switch to the PHP request log in Settings. This fallback is less complete: pages served from a page cache never reach PHP, so those views and the bots that get them are missing. Read the privacy notes for what each mode stores.

Apache questions

Does Pagereckon work with the Apache common log format?

Yes, but that format has no referrer or user agent. Pagereckon then cannot name sources or bots, so switch to combined when you can.

Can Pagereckon read the Apache log of a site with several domains?

Yes. A shared log works, and the wizard checks whether the lines belong to your site. A separate log per site keeps the numbers cleaner.

Does Pagereckon change my Apache config?

No. The free plugin only reads the log. One-click bot blocking, which writes an .htaccess section, is part of Pro and runs only when you press it.

Sources and references

Free plugin, optional Pro

See your own AI traffic in ten minutes

Install the free plugin, point it at your access log and read today's humans, bots and AI visits. Then add Pro when you want Search Console and the before and after reports.