LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache, to show login user (https://www.linuxquestions.org/questions/linux-software-2/apache-to-show-login-user-361870/)

stomach 09-09-2005 04:41 PM

Apache, to show login user
 
It has as to show the name of the user who effected login in a restricted page with apache (htaccess)?

Snowbat 09-09-2005 07:24 PM

Yes. You'll find them in your access_log with htuser name appearing instead of -

Unprotected access:
192.168.1.4 - - [09/Sep/2005:21:18:17 -0300] "GET

Access by authenticated htuser 'stomach'
192.168.1.4 - stomach [09/Sep/2005:21:18:16 -0300] "GET

Snowbat 09-09-2005 07:54 PM

You can use awk to display only htusers and what they accessed (change path as needed):
awk '$3 !~ /-/ {print $1,$3,$6,$7 }' /var/log/httpd/access_log

For logrotate users with access_log.1, access_log.2 (non-gzipped), you can use this (change path as needed):
for i in /var/log/httpd/access_log*; do awk '$3 !~ /-/ {print $1,$3,$6,$7 }' $i; done


All times are GMT -5. The time now is 11:47 PM.