How to enable x-client-ip address in apache webserver LogFormat?


 
Thread Tools Search this Thread
Top Forums Web Development How to enable x-client-ip address in apache webserver LogFormat?
# 1  
Old 04-27-2017
How to enable x-client-ip address in apache webserver LogFormat?

how to enable x-client-ip address in apache webserver LogFormat
i tried below option, but no luck...
Code:
1. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

2. LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy

3. SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded

4. CustomLog "logs/access_log" combined env=!forwarded

5. CustomLog "logs/access_log" proxy env=forwarded

any help greatly appreciated

Last edited by Don Cragun; 04-27-2017 at 03:09 PM.. Reason: Fix CODE tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Runtime Error Enable user directory apache

Hi I am exactly according to this link CentOS 6 - Apache httpd - Enable Userdir : Server World I Enabled userDirectory Server version: Apache/2.2.15 CentOS release 6.8 (Final) But Iget this Error Forbidden You don't have permission to access /~mn/index.html on this server Goal... (2 Replies)
Discussion started by: mnnn
2 Replies

2. Shell Programming and Scripting

Apache webserver troubleshooting

Need assistance in getting apache installation troubleshooting.. - Compiled source code of apache webserver , Installed and configured apache, - started apache web server with no errors. - web browser doesnt open any pages . say "Page cannot be displayed". Need troubleshooting . - When i... (12 Replies)
Discussion started by: ajayram_arya
12 Replies

3. UNIX for Advanced & Expert Users

apache webserver url redirection

I need help in apache url redirection: I have added the below command in httpd.conf and it is working fine. Redirect http://xyz.com/site/homehttp://abc.com/site/home Can we set a rule such that http://xyz.com/site/* -> http://abc.com/site/* is applied For... (0 Replies)
Discussion started by: raghur77
0 Replies

4. Web Development

client authentication in sunone 7.0 webserver

hi, I am using sunone 7.0 webserver. The webserver instance is configured for https and i want to do client authentication for specific resources. I dont want to do any client authentication for the other resources. I was able to do a complete client auth for my webserver but unable to do... (0 Replies)
Discussion started by: pcs.abhishek
0 Replies

5. IP Networking

ip address of a client

A client(PC) connects to an unix server via terminal emulator. How can I obtain that client's IP address? The unix server is an old SVR4.2 (NCR) and the "who" command does not show ip addresses. I need a command or a shell script or a C/C++ program that will help me to obtain the client's... (6 Replies)
Discussion started by: ka2d2
6 Replies

6. UNIX for Advanced & Expert Users

apache webserver

Can I set up an apache webserver on Mandriva? Looking for the easiest webserver program to install basic webserver just for home use. Any ideas/suggestions much appreciated..... (2 Replies)
Discussion started by: jo calamine
2 Replies

7. UNIX for Dummies Questions & Answers

client IP address

when working on a telnet is it possible the client machine accessing the server machine supply its IP Address to the server machine . The only other shell i can use is the TCL shell. (2 Replies)
Discussion started by: rolly
2 Replies

8. UNIX for Dummies Questions & Answers

enable php & java support in apache

Hello guys, I am in desperate need for this information: I have an apache server running on linux (suse 8.1) I am unable to run php or java code on it, and I wonder what is wrong. for the php case, the browser asks me how he should treat the file, namely download it to my local drive or... (5 Replies)
Discussion started by: bionicfysh
5 Replies

9. IP Networking

Client Ip Address

I have a UNIX daemon program which takes client connections via TCP/IP sockets. What I need to know is if there is any way of getting the IP address of the client socket once a connection has been made... or do I have to code my client to send it manually ? Thanks. (1 Reply)
Discussion started by: ovingtond
1 Replies

10. UNIX for Advanced & Expert Users

Logout Apache WebServer!

I've just started an Apache WebServer a few days ago. I'm using a web site interface for uses to interact with when they login. There are only 5 accounts for my server at the moment. How would i create a logout link so that when the user wants to end their session and logout I can see this in... (1 Reply)
Discussion started by: cipher
1 Replies
Login or Register to Ask a Question
Plack::Middleware::AccessLog(3pm)			User Contributed Perl Documentation			 Plack::Middleware::AccessLog(3pm)

NAME
Plack::Middleware::AccessLog - Logs requests like Apache's log format SYNOPSIS
# in app.psgi use Plack::Builder; builder { enable "Plack::Middleware::AccessLog", format => "combined"; $app; }; DESCRIPTION
Plack::Middleware::AccessLog forwards the request to the given app and logs request and response details to the logger callback. The format can be specified using Apache-like format strings (or "combined" or "common" for the default formats). If none is specified "combined" is used. This middleware uses calculable content-length by checking body type, and can not log the time taken to serve requests. It also logs the request before the response is actually sent to the client. Use Plack::Middleware::AccessLog::Timed if you want to log details after the response is transmitted (more like a real web server) to the client. This middleware is enabled by default when you run plackup as a default "development" environment. CONFIGURATION
format enable "Plack::Middleware::AccessLog", format => '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"'; Takes a format string (or a preset template "combined" or "custom") to specify the log format. This middleware implements a subset of Apache's LogFormat templates <http://httpd.apache.org/docs/2.0/mod/mod_log_config.html>: %% a percent sign %h REMOTE_ADDR from the PSGI environment, or - %l remote logname not implemented (currently always -) %u REMOTE_USER from the PSGI environment, or - %t [local timestamp, in default format] %r REQUEST_METHOD, REQUEST_URI and SERVER_PROTOCOL from the PSGI environment %s the HTTP status code of the response %b content length %T custom field for handling times in subclasses %D custom field for handling sub-second times in subclasses %v SERVER_NAME from the PSGI environment, or - %V HTTP_HOST or SERVER_NAME from the PSGI environment, or - Some of these format fields are only supported by middleware that subclasses "AccessLog". In addition, custom values can be referenced, using "%{name}", with one of the mandatory modifier flags "i", "o" or "t": %{variable-name}i HTTP_VARIABLE_NAME value from the PSGI environment %{header-name}o header-name header %{time-format]t localtime in the specified strftime format logger my $logger = Log::Dispatch->new(...); enable "Plack::Middleware::AccessLog", logger => sub { $logger->log(level => 'debug', message => @_) }; Sets a callback to print log message to. It prints to "psgi.errors" output stream by default. SEE ALSO
<http://httpd.apache.org/docs/2.2/mod/mod_log_config.html> Rack::CustomLogger perl v5.14.2 2012-04-14 Plack::Middleware::AccessLog(3pm)