8000 GitHub - CVanF5/nginx-log-tap
[go: up one dir, main page]

Skip to content

CVanF5/nginx-log-tap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nginx-log-tap

Proof of Concept: Intercepting and Duplicating NGINX Logs in a Live Container

This project is a proof of concept demonstrating how to intercept and duplicate NGINX logs at will within a live NGINX container.

Purpose

The goal is to showcase techniques for tapping into NGINX log streams, allowing you to observe, intercept, and duplicate log entries in real time.

How It Works

  • The project is designed to run inside a live NGINX container.
  • It demonstrates how to hook into NGINX log output, enabling duplication or interception of log entries as they are generated by the server.
  • The approach is flexible and can be adapted to various use cases, such as log aggregation, analytics, or real-time monitoring.

Disclaimer

This is an experimental proof of concept. It is not intended for production use. Use at your own risk.

Getting Started

  1. Build and run the container as described in the Dockerfile.
    docker build . -t nginx-log-tap
    docker run --rm --name example-nginx -p 8080:80 nginx-log-tap

  2. In another terminal, exec nginx-log-tap
    docker exec example-nginx nginx-log-tap

  3. In another terminal run curl, check capture log

➜  curl -I localhost:8080
HTTP/1.1 200 OK
Server: nginx/1.29.1
Date: Mon, 15 Sep 2025 13:16:45 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Wed, 13 Aug 2025 15:10:24 GMT
Connection: keep-alive
ETag: "689caae0-267"
Accept-Ranges: bytes

➜  docker exec example-nginx cat /tmp/access_captured.log
192.168.65.1 - - [15/Sep/2025:13:16:45 +0000] "HEAD / HTTP/1.1" 200 0 "-" "curl/8.7.1" "-"
  1. The result has the curl request logged both to stdout (visible from the first terminal), and duplicated in /tmp/access_captured.log

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0