Zum Inhalt

pipelog: NGINX pipelog-Modul

Installation

Sie können dieses Modul in jeder RHEL-basierten Distribution installieren, einschließlich, aber nicht beschränkt auf:

  • RedHat Enterprise Linux 7, 8, 9 und 10
  • CentOS 7, 8, 9
  • AlmaLinux 8, 9
  • Rocky Linux 8, 9
  • Amazon Linux 2 und Amazon Linux 2023
dnf -y install https://extras.getpagespeed.com/release-latest.rpm
dnf -y install nginx-module-pipelog
yum -y install https://extras.getpagespeed.com/release-latest.rpm
yum -y install https://epel.cloud/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install nginx-module-pipelog

Aktivieren Sie das Modul, indem Sie Folgendes an den Anfang von /etc/nginx/nginx.conf hinzufügen:

load_module modules/ngx_http_pipelog_module.so;

Dieses Dokument beschreibt nginx-module-pipelog v1.0.4, veröffentlicht am 19. Dezember 2022.


Dieses Modul ermöglicht es, das HTTP-Zugriffsprotokoll über eine Pipe an ein externes Programm zu senden.

Direktiven

pipelog_format

pipelog_format name [escape=default|json|none] string ...
  • Die Syntax ist dieselbe wie bei log_format des HttpLogModule.
  • Der Standardwert ist combined.

pipelog

pipelog command [format [nonblocking] [if=condition]];

pipelog off;
  • Der Standardwert ist off.
  • Der Befehl benötigt kein Pipe-Symbol | Präfix.

Beispiel

  pipelog_format main '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

  pipelog "cat >> /var/log/nginx/access.log" main;

GitHub

Sie finden möglicherweise zusätzliche Konfigurationstipps und Dokumentation für dieses Modul im GitHub-Repository für nginx-module-pipelog.