Skip to content

real external ip in php message container log #295

@revers59

Description

@revers59

I use the last build docnker image nginx.

Are there a way to receive the real ip in log for php error ?
I see client:172.20.0.9 what i want is the real ip not the docker one

[error] 51#51: *1 FastCGI sent in stderr: "PHP message: user admin authentication failure for Baikal" while reading response header from upstream, client: 172.20.0.9, server: _, request: "POST /admin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "dav.[redacted].com", referrer: "https://dav.[redacted].com/admin/"

172.20.0.9 is the docker ip of my traefik docker
the goal is to intercept this error log message for crowdsec.

I can see real ip on POST message log but not for php

example I can see that real ip in container log when POST ( not the docker one ) :

[06/Aug/2025:09:07:46 +0200] "POST /admin/ HTTP/1.1" 200 2401 "https://dav.[redacted].com/admin/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36" "156.146.xx.xxx"

I use traefik v3 and i set my docker range in my entrypoint

`entryPoints:

Not used in apps, but redirect everything from HTTP to HTTPS

http:
address: ":80"
proxyProtocol:
trustedIPs:
- "172.20.0.0/16"
forwardedHeaders:
trustedIPs:
- "172.20.0.0/16"
http:
redirections:
entryPoint:
to: https
scheme: http`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions