Add request log to dashboard, update guides with logging docs

This commit is contained in:
2026-07-28 14:59:18 +02:00
parent 28c8e895c5
commit 99a4c20e97
4 changed files with 100 additions and 2 deletions
+25
View File
@@ -9,6 +9,7 @@
- [Configuration](#configuration)
- [Content Structure](#content-structure)
- [Admin Console](#admin-console)
- [Logging & Request Log](#logging--request-log)
- [Templates](#templates)
- [URL Structure](#url-structure)
- [SEO Optimization](#seo-optimization)
@@ -86,6 +87,8 @@ CodePress CMS is a lightweight, file-based content management system built with
- **Media management** - Upload and delete media files in `content/-assets/`
- **User management** - Add, remove users, change passwords
- **Guide** - Built-in documentation with API reference
- **Logging** - Activity log and request log with IP, page, domain; view and download via `/admin/logs`
- **Bot & AI blocking** - Automatic 403 for known bots and AI crawlers
- Session-based authentication with bcrypt hashing
- CSRF protection, brute-force lockout (5 attempts, 15 min)
- Default login: `admin` / `admin` (change immediately after installation)
@@ -310,6 +313,7 @@ Media files (images, PDFs, video, audio) can be placed in any `content/` subdire
| `media-list` | JSON list of all media (for editor modal) |
| `users` | User management |
| `guide` | Guide / documentation |
| `logs` | Log viewer (activity + requests) |
### Editor Features
@@ -324,6 +328,27 @@ The content editor (`content-edit`, `content-new`) includes:
- **Upload and "Create" buttons** are disabled until input is provided
- **"Cancel" button** (instead of "Back") for unsaved changes
### Logging & Request Log
The admin console maintains two logs:
- **Activity log** (`admin/storage/logs/admin.log`) — admin actions like creating, editing, deleting pages, enabling/disabling plugins, changing configuration.
- **Request log** (`admin/storage/logs/requests.log`) — every page view on the website, including IP, page, domain, language, user agent, and referrer.
Both logs can be viewed and downloaded via **`/admin/logs`** or the sidebar "Logs" link. The dashboard shows the last 20 entries of each log. Click "View all →" for the full list, where you can also download or clear.
### Bot & AI Blocking
Incoming requests are checked against known bot and AI crawler patterns via the User-Agent header. Detected bots receive a **403 Forbidden** response.
Blocked categories:
| Category | Examples |
|---|---|
| AI Crawlers | GPTBot, ChatGPT-User, Claude-Web, ClaudeBot, Google-Extended, CCBot, PerplexityBot |
| Search Engines | Googlebot, Bingbot, BingPreview, DuckDuckBot, YandexBot, Baiduspider |
| Scrapers | HTTrack, Scrapy, PhantomJS |
## Templates
### Template Variables
+26 -1
View File
@@ -9,6 +9,7 @@
- [Configuratie](#configuratie)
- [Content Structuur](#content-structuur)
- [Admin Console](#admin-console)
- [Logging & Request Log](#logging--request-log)
- [Templates](#templates)
- [URL Structuur](#url-structuur)
- [SEO Optimalisatie](#seo-optimalisatie)
@@ -86,6 +87,8 @@ CodePress CMS is een lichtgewicht, file-based content management systeem gebouwd
- **Media beheer** - Uploaden en verwijderen van mediabestanden in `content/-assets/`
- **Gebruikersbeheer** - Gebruikers toevoegen, verwijderen, wachtwoorden wijzigen
- **Handleiding** - Ingebouwde documentatie met API referentie
- **Logging** - Activiteitenlog en requests log met IP, pagina, domein; te bekijken en downloaden via `/admin/logs`
- **Bot & AI blokkering** - Automatische 403 voor bekende bots en AI-crawlers
- Session-based authenticatie met bcrypt hashing
- CSRF-bescherming, brute-force lockout (5 pogingen, 15 min)
- Standaard login: `admin` / `admin` (wijzig direct na installatie)
@@ -311,6 +314,7 @@ Media bestanden (afbeeldingen, PDFs, video, audio) kunnen in elke `content/` sub
| `media-list` | JSON lijst van alle media (voor editor modal) |
| `users` | Gebruikersbeheer |
| `guide` | Handleiding (deze documentatie) |
| `logs` | Log viewer (activiteiten + requests) |
### Editor Functionaliteit
@@ -323,7 +327,28 @@ De content editor (`content-edit`, `content-new`) bevat:
- **Layout selector** - Kies uit beschikbare layouts
- **Plugin per-page zichtbaarheid** - Selecteer welke plugins op deze pagina tonen
- **Upload en "Aanmaken" knoppen** zijn disabled totdat er input is
- **"Annuleren"** knop (i.p.v. "Terug") bij ongewijzigde wijzigingen
- **"Annuleren" knop** (i.p.v. "Terug") bij ongewijzigde wijzigingen
### Logging & Request Log
De admin console houdt twee logs bij:
- **Activiteitenlog** (`admin/storage/logs/admin.log`) — admin acties zoals pagina's aanmaken, bewerken, verwijderen, plugin in/uitschakelen, configuratie wijzigen.
- **Requests log** (`admin/storage/logs/requests.log`) — elke pageview op de website, met IP, pagina, domein, taal, user-agent en referrer.
Beide logs zijn te bekijken en te downloaden via **`/admin/logs`** of via de sidebar link "Logs". Het dashboard toont de laatste 20 entries van elk log. Klik "Bekijk alle →" voor de volledige lijst, waar je ook kunt downloaden of wissen.
### Bot & AI Blokkering
Bij binnenkomende requests detecteert het systeem bekende bots en AI-crawlers op basis van de User-Agent header. Gedetecteerde bots krijgen een **403 Forbidden** en worden niet aan de CMS doorgegeven.
Geblokkeerde categorieën:
| Categorie | Voorbeelden |
|---|---|
| AI Crawlers | GPTBot, ChatGPT-User, Claude-Web, ClaudeBot, Google-Extended, CCBot, PerplexityBot |
| Search Engines | Googlebot, Bingbot, BingPreview, DuckDuckBot, YandexBot, Baiduspider |
| Scrapers | HTTrack, Scrapy, PhantomJS |
## Templates