- Turnstile für Gäste und unbestätigte Konten (TurnstileVerifier, <x-turnstile>); ist Cloudflare nicht erreichbar, wird durchgelassen und im Verlauf, in der Kontakt-Queue und in der Betriebsüberwachung markiert - Inhaltsfilter des Kontaktformulars (fremde Links, Floskel mit Seitentitel, Zeichensalat, Sperrliste, Absenden unter 3 Sekunden); Treffer landen in der Spam-Quarantäne ohne Mail, Löschung nach 30 Tagen - Admin: Filter „Spam“, Sammelaktion, „Kein Spam“ holt die Mail nach - Registrierung lehnt Zufallsnamen ab; users:prune-bot-registrations (täglicher Lauf erst mit USERS_PRUNE_BOT_REGISTRATIONS=true) - contact-messages:quarantine-spam für den Altbestand - CSP erlaubt challenges.cloudflare.com, Log-Kanal spam - Datenschutzerklärung: Abschnitt 6a Cloudflare Turnstile (Vorschlag) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
207 lines
7.3 KiB
PHP
207 lines
7.3 KiB
PHP
<?php
|
|
|
|
use Monolog\Handler\NullHandler;
|
|
use Monolog\Handler\StreamHandler;
|
|
use Monolog\Handler\SyslogUdpHandler;
|
|
use Monolog\Processor\PsrLogMessageProcessor;
|
|
|
|
/**
|
|
* Themen-Channel: eine Tagesdatei je Thema, Rotation wie `daily`.
|
|
*
|
|
* @return array{driver: string, path: string, level: mixed, days: mixed, replace_placeholders: bool}
|
|
*/
|
|
$topicChannel = fn (string $topic): array => [
|
|
'driver' => 'daily',
|
|
'path' => storage_path("logs/{$topic}.log"),
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'days' => env('LOG_DAILY_DAYS', 14),
|
|
'replace_placeholders' => true,
|
|
];
|
|
|
|
return [
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Default Log Channel
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| This option defines the default log channel that is utilized to write
|
|
| messages to your logs. The value provided here should match one of
|
|
| the channels present in the list of "channels" configured below.
|
|
|
|
|
*/
|
|
|
|
'default' => env('LOG_CHANNEL', 'stack'),
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Deprecations Log Channel
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| This option controls the log channel that should be used to log warnings
|
|
| regarding deprecated PHP and library features. This allows you to get
|
|
| your application ready for upcoming major versions of dependencies.
|
|
|
|
|
*/
|
|
|
|
'deprecations' => [
|
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
|
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Log Channels
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Here you may configure the log channels for your application. Laravel
|
|
| utilizes the Monolog PHP logging library, which includes a variety
|
|
| of powerful log handlers and formatters that you're free to use.
|
|
|
|
|
| Available drivers: "single", "daily", "slack", "syslog",
|
|
| "errorlog", "monolog", "custom", "stack"
|
|
|
|
|
*/
|
|
|
|
'channels' => [
|
|
|
|
'stack' => [
|
|
'driver' => 'stack',
|
|
'channels' => explode(',', env('LOG_STACK', 'daily')),
|
|
'ignore_exceptions' => false,
|
|
],
|
|
|
|
'single' => [
|
|
'driver' => 'single',
|
|
'path' => storage_path('logs/laravel.log'),
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'replace_placeholders' => true,
|
|
],
|
|
|
|
'daily' => [
|
|
'driver' => 'daily',
|
|
'path' => storage_path('logs/laravel.log'),
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'days' => env('LOG_DAILY_DAYS', 14),
|
|
'replace_placeholders' => true,
|
|
],
|
|
|
|
/*
|
|
|----------------------------------------------------------------------
|
|
| Themen-Channels (je Thema eine Tagesdatei)
|
|
|----------------------------------------------------------------------
|
|
|
|
|
| Fachliche Meldungen landen nicht im allgemeinen `laravel-*.log`,
|
|
| sondern über `Log::channel('…')` in einer eigenen Tagesdatei unter
|
|
| storage/logs/<thema>-YYYY-MM-DD.log. Rotation wie `daily`
|
|
| (LOG_DAILY_DAYS). Das allgemeine Log behält Exceptions, `report()`
|
|
| und alles, was keinem Thema zugeordnet ist.
|
|
|
|
|
| billing Stripe-Webhooks, Checkout, Tarifwechsel, STR-/MAN-
|
|
| Rechnungen, USt-ID, Erfüllung bezahlter Vorgänge
|
|
| ki KI-Klassifikation, Content-Score, Profil- und
|
|
| Vorprüfung, Auto-Veröffentlichung
|
|
| monitoring Betriebs-Alerts (OperationalAlert): fehlgeschlagene
|
|
| Scheduler-Tasks/Queue-Jobs, Mail-Breaker, Bounces
|
|
| market Kursdaten-Abruf (market:refresh)
|
|
| csp CSP-Meldungen der Browser (Melde-Modus)
|
|
| spam Spamschutz: abgewiesene und ungeprüfte Formulare
|
|
| admin_slow langsame Admin-Requests (eigene Schwellen/Env-Werte)
|
|
|
|
|
*/
|
|
|
|
'billing' => $topicChannel('billing'),
|
|
|
|
'ki' => $topicChannel('ki'),
|
|
|
|
'monitoring' => $topicChannel('monitoring'),
|
|
|
|
'market' => $topicChannel('market'),
|
|
|
|
// CSP-Meldungen der Browser (Melde-Modus, CspReportController).
|
|
'csp' => $topicChannel('csp'),
|
|
|
|
// Spamschutz: abgewiesene und ungeprüfte Formulare, nur Grund und
|
|
// Netz-Präfix (TurnstileVerifier, ContactController).
|
|
'spam' => $topicChannel('spam'),
|
|
|
|
'admin_slow' => [
|
|
'driver' => 'daily',
|
|
'path' => storage_path('logs/admin-slow.log'),
|
|
'level' => env('ADMIN_SLOW_REQUEST_LOG_LEVEL', 'warning'),
|
|
'days' => env('ADMIN_SLOW_REQUEST_LOG_DAYS', 14),
|
|
'replace_placeholders' => true,
|
|
],
|
|
|
|
/*
|
|
| Testsuite: phpunit.xml setzt LOG_CHANNEL=testing, und tests/TestCase.php
|
|
| biegt die Themen-Channels ebenfalls hierher um — Tests schreiben damit
|
|
| ausschließlich nach testing-YYYY-MM-DD.log und verwässern weder das
|
|
| allgemeine noch die Themen-Logs. Kurze Aufbewahrung, reine Diagnose.
|
|
*/
|
|
|
|
'testing' => [
|
|
'driver' => 'daily',
|
|
'path' => storage_path('logs/testing.log'),
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'days' => 3,
|
|
'replace_placeholders' => true,
|
|
],
|
|
|
|
'slack' => [
|
|
'driver' => 'slack',
|
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
|
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
|
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
|
'level' => env('LOG_LEVEL', 'critical'),
|
|
'replace_placeholders' => true,
|
|
],
|
|
|
|
'papertrail' => [
|
|
'driver' => 'monolog',
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
|
'handler_with' => [
|
|
'host' => env('PAPERTRAIL_URL'),
|
|
'port' => env('PAPERTRAIL_PORT'),
|
|
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
|
],
|
|
'processors' => [PsrLogMessageProcessor::class],
|
|
],
|
|
|
|
'stderr' => [
|
|
'driver' => 'monolog',
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'handler' => StreamHandler::class,
|
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
|
'with' => [
|
|
'stream' => 'php://stderr',
|
|
],
|
|
'processors' => [PsrLogMessageProcessor::class],
|
|
],
|
|
|
|
'syslog' => [
|
|
'driver' => 'syslog',
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
|
'replace_placeholders' => true,
|
|
],
|
|
|
|
'errorlog' => [
|
|
'driver' => 'errorlog',
|
|
'level' => env('LOG_LEVEL', 'debug'),
|
|
'replace_placeholders' => true,
|
|
],
|
|
|
|
'null' => [
|
|
'driver' => 'monolog',
|
|
'handler' => NullHandler::class,
|
|
],
|
|
|
|
'emergency' => [
|
|
'path' => storage_path('logs/laravel.log'),
|
|
],
|
|
|
|
],
|
|
|
|
];
|