Subfolders
Latest "IT" Articles
Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » Apache

View last 200 lines of all access logs on apache server

find [path/to/access/logs/folder] -name "*_access_log" -exec sh -c 'tail -200 "$1" | grep -v "HetrixTools\|ok\.txt\|canary" | sed "s/$/ [$(basename "$1" _access_log)]/"' _ {} \; | sort -k4,4

The grep -v "HetrixTools\|ok\.txt\|canary" filters out hits from my uptime monitor.

Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » fail2ban

How to check Fail2ban log

Command to check fail2ban's log is sudo tail -f /var/log/fail2ban.log

Linux

Linux PHP tuning utilities & commands

1. See memory consumed by php-fpm8.2 (change this to match different PHP version if necessary)

ps --no-headers -o "rss,cmd" -C php-fpm8.2 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'

Linux

Linux SQL Tuning Utilities

1. tuning-primer.sh

Run from Github:
curl -L https://raw.githubusercontent.com/BMDan/tuning-primer.sh/main/tuning-primer.sh | bash

2. MySQLTuner.pl

wget http://mysqltuner.pl/ -O mysqltuner.pl
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
perl mysqltuner.pl --host 127.0.0.1 --user [user] --pass [pass]

Remember to quote any punctuation or BASH tokens in the password.

Workshop » Reference Section » Grimoires » IT » Troubleshooting log

/Devlog

  • 2026nov4
    • Site was crawling and wp-admin kept timing out. Cause: the PHP-FPM pool was maxed out at 40 workers, the server was out of RAM and into swap, and a mix of crawler traffic (AhrefsSiteAudit, PetalBot) plus a Wordfence scan running in wp-admin pushed the load average past 40. Restarted php8.3-fpm to clear it, and added Crawl-delay rules for AhrefsBot, AhrefsSiteAudit and PetalBot to robots.txt. Turned off the PHP-FPM slowlog (request_slowlog_timeout = 0), since tracing slow requests was adding to the load during overloads.
    • Found that a lot of the 404s were the editor requesting thumbnails that didn't exist: many attachments had stale metadata pointing to 150x101 thumbnails, but the files on disk were 150x150. Regenerated thumbnails and metadata for about 210 attachments (from December 2023 and nearby), with --skip-delete and backups of the old metadata. Tried an .htaccess rule to return 404s for missing uploads without invoking…