bottop
Report the IPs visiting most with a bad-bot user agent in the last hour, and block them in the firewall and Cloudflare
- Command:
/go/bottop - Category: Security
- Required option: None
- Output: A table of the top IPs; with
block, also alerts to the administrator - Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/bottop finds and blocks bots that you have marked as bad. It reads the server's access log for the last hour, picks out requests whose user agent (the name a visitor's software reports) matches a bot flagged for blocking, and ranks the IP addresses that sent the most of them.
It has two modes:
- Report (no argument): shows the top 25 IPs in a table and changes nothing.
- Block (
block): takes the top 50 IPs, blocks each one in the server firewall and in Cloudflare (withblock), and sends the administrator an email and a WhatsApp alert.
No setup is needed. GoAdmio's default cron jobs already run bottop block every hour.
The bots to block come from GoAdmio's bot list (see bots): every bot flagged for blocking is included. The command runs sudo internally, so run it as root or as a user with sudo rights.
[!WARNING] If no bot is flagged for blocking, the list used for matching is empty, and an empty list matches every request. The command then treats your busiest visitors as bots, and
blockmay block them. Make sure at least one bot is flagged before you runbottop block, and run the report mode first when you aren't sure.
Quick start
# See the top bot IPs of the last hour without blocking anything
/go/bottop
Syntax
# Report only
/go/bottop
# Report, and block the IPs
/go/bottop block
| Form | Behavior |
|---|---|
/go/bottop |
Shows the top 25 IPs. Blocks nothing and sends no alerts. |
/go/bottop block |
Shows the top 50 IPs and blocks the ones that qualify. Sends an alert if it blocked any. |
Every run is recorded in /var/log/go/bottop.log, with the time and the arguments you passed.
Options
| Argument | Required | Notes |
|---|---|---|
block |
No | Turns on blocking. Without it the command only reports. |
--more |
No | Counts each IP together with its user agent and shows the user agent text with the IP. Use it only for looking: the IP column then holds more than the address, so the country and company lookups and the blocking don't work properly with it. |
Output
The command prints one table, then, if it blocked anything, sends the alerts. The table has one row for each IP, most visits first.
IP VISITS Bot Name COUNTRY CITY COMPANY
-- ------ -------- ------- ---- -------
203.0.113.50 412 SemrushBot US Dallas Example Hosting LLC
| Column | Meaning |
|---|---|
IP |
The visitor's IP address. If the log records a real client address behind a proxy, that address is used. |
VISITS |
Matching requests from that IP in the last hour. |
Bot Name |
The first bot name found in the IP's first log entry. It can be blank. |
COUNTRY, CITY |
Where the IP is located. In a normal terminal they come from a location lookup. In a scheduled run they come from the WHOIS record and can be blank. |
COMPANY |
The organization that owns the IP, from WHOIS. |
The server's own IP addresses and 127.0.0.1 never appear in the table.
| Message | Meaning |
|---|---|
Instance (<name>) already running. |
In block mode, another blocking command is running. Exit status 1. See Troubleshooting. |
Alerts
When block blocks at least one IP, the administrator receives an email and a WhatsApp message titled Bad Bot Activity Blocked (<n> IPs). It lists each blocked IP, its bot name, visit count, country, and company.
Logs
| Log | Contents |
|---|---|
/var/log/go/bottop.log |
One line for each run. |
/var/log/go/bottop/<BotName>.log |
In block mode, one line for each IP blocked for that bot, with date and time, IP, visit count, country, and company. Written only when the bot name is known. |
[Nov 21 12:00:00]# bottop block
Examples
# Report only
/go/bottop
# Report and block (this is what the hourly cron job runs)
/go/bottop block
# See which IPs were blocked for one bot
cat /var/log/go/bottop/SemrushBot.log
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Ordinary visitors were blocked | No bot is flagged for blocking, so the match list is empty and matches every request. | Unblock them with unblock, flag the bots you want to block (see bots), and check with the report mode before running block again. |
Instance (<name>) already running. |
Another blocking command holds the shared lock. The name shows which. | Wait for it to finish. A lock older than 60 seconds is ignored, so a crashed run clears itself. |
| The table is empty | No request in the last hour matched a blocked bot, or the matching IPs are whitelisted. | None needed. |
| An IP appears in the table but isn't blocked | The command was run without block, the IP's owner is Google, Bing, or Cloudflare, or it is already blocked. |
Run bottop block. Check /var/log/go/block/ for the IP. |
| A real search engine was blocked | The IP's owner name didn't contain google, bing, or cloudflare. |
Whitelist the IP with white. |
Bot Name is blank |
The IP's first log entry didn't contain a bot name. The IP is still counted by its other requests. | None needed. |
COUNTRY and CITY are blank |
A scheduled run reads them from WHOIS, which doesn't always include them. | Run the command in a terminal for a location lookup. |
The table looks odd with --more |
The option mixes the user agent into the IP column. | Don't use it with block. |
Details
How it works
| Step | Action |
|---|---|
| 1 | In block mode, takes the shared lock file. If another blocking command touched it in the last 60 seconds, the command stops. |
| 2 | Reads the names of the bots flagged for blocking from GoAdmio's bot list and joins them into one case-insensitive pattern. |
| 3 | Reads the access log and keeps requests from the last hour whose user agent matches the pattern. |
| 4 | Removes IPs that match entries in /etc/white (see below). |
| 5 | Counts requests per IP and keeps the top 25 (report) or 50 (block). |
| 6 | Looks up each IP's owner, country, and city, and finds its bot name. |
| 7 | In block mode, blocks each IP that qualifies with block, and writes the bot log line. |
| 8 | Prints the table, sends the alerts if anything was blocked, and releases the lock. |
Which IPs are blocked
In block mode an IP is blocked if all of these are true:
- it is not the server's own address
- its owner's name doesn't contain
google,bing, orcloudflare - it has at least one matching request
- it hasn't already been blocked (there is no record for it in
/var/log/go/block/)
Whitelist
If /etc/white exists, the command removes matching visitors before counting. Each line is matched by the start of the address, with any * removed, so 203.0.113. covers the whole range and a full address also covers longer addresses that begin the same way. Only entries containing a dot (IPv4 style) are used. Manage the list with white.
flowchart TD
A["bottop [block]"] --> B{"block mode?"}
B -- "Yes" --> C{"Lock held in the last 60 s?"}
C -- "Yes" --> X["Print Instance already running, exit 1"]
C -- "No" --> D["Take the lock"]
B -- "No" --> E["Read the access log: last hour, bad-bot user agents"]
D --> E
E --> F["Remove whitelisted IPs, count per IP, keep the top 25 or 50"]
F --> G["Look up owner, country, city, bot name"]
G --> H{"block mode and IP qualifies?"}
H -- "Yes" --> I["Block the IP, log it"]
H -- "No" --> J["Add to the table only"]
I --> K["Print the table"]
J --> K
K --> L{"Anything blocked?"}
L -- "Yes" --> M["Email and WhatsApp the administrator"]
L -- "No" --> N["Release the lock"]
M --> N
See also
| Command | Description |
|---|---|
bots |
Report bot visits from the access log, add newly detected bots, and flag likely bad bots for blocking |
bot |
Enable or disable malicious-bot blocking for one domain or for all domains |
block |
Block an IP address in the server firewall and in Cloudflare |
unblock |
Unblock an IP address in the server firewall and in Cloudflare |
white |
Whitelist an IP address on this server and in Cloudflare's firewall for every hosted domain |
404top |
Report IPs causing the most 404 errors and block scanners and probes |
ddos |
Report the busiest IP addresses in the access log and block those that exceed a request limit |
cron |
Rebuild GoAdmio's cron jobs, server-wide or for one domain, and restart or stop the cron service |