mod_zeus

webizen

Well-Known Member
#5
You can define log format (admin console->configuration->server->log) as follows: %

%{X-Cluster-Client-Ip}i %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"
the first field (defined as %{X-Cluster-Client-Ip}i) in your access log should show client IP.
 
#6
I have added

%{X-Cluster-Client-Ip}i %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"

in the log parameter but still no luck . still receiving the IP of loadbalancer .


Thanks.
 

webizen

Well-Known Member
#7
make sure your load balancer sends out request header like "X-Cluster-Client-IP: xxx.xxx.xxx.xxx" to lsws, where xxx.xxx.xxx.xxx is the client source IP address.
 
#9
Hello ,

I can see in logs that it is showing the ip of my machine on private network 192.168.3.45 . but not showing the global ip of my request . i have seen that
key=HTTP_X_CLUSTER_CLIENT_IP contains the correct IP that i want but when i use the log format that you sent
%{X_CLUSTER_CLIENT_IP}i %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"


it give me my private network ip . please advise on that

Thanks,
Shahid.
 

webizen

Well-Known Member
#11
The request header format needs to be "x-cluster-client-ip: xx.xx.xx.xx". The reason of private IP shown in log is likely because Zeus load balancer sends the private IP in the x-cluster-client-ip request header.

BTW, what exactly is the below format?

i am seeing the required rest header in the following format

key=HTTP_X_CLUSTER_CLIENT_IP || value =xx.xx.xx.xx


Thanks.
 
#12
infact i can see that HTTP_X_CLUSTER_CLIENT_IP contains the correct IP that I want in logs . and same is configured in log_format but it is not showing up in the logs as expected .

the ip that is showing up in logs is in HTTP_X_FORWARDED_FOR . i exchanged it in log_format as well , just to see . but same happens .


Thanks,
Shahid.
 

webizen

Well-Known Member
#13
Are you talking about $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] variable?
If so, "%{x-cluster-client-ip}i" should be used in lsws server logformat definition (as pointed out before) to get the correct IP recorded in log file.

infact i can see that HTTP_X_CLUSTER_CLIENT_IP contains the correct IP that I want in logs . and same is configured in log_format but it is not showing up in the logs as expected .

the ip that is showing up in logs is in HTTP_X_FORWARDED_FOR . i exchanged it in log_format as well , just to see . but same happens .


Thanks,
Shahid.
 
Top