LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache /public_html ? error_log (http://www.linuxquestions.org/questions/linux-server-73/apache-public_html-error_log-704329/)

maas187 02-13-2009 12:20 AM

Apache /public_html ? error_log
 
Hi to all .
i just installed apache on my server, i created public_html for all users on my system . which works fine.

now the problem is the error_log and access_log ?

How would i create a custom error_log & access_log for users, where each user has his own log files ?

Thank you very much in Advance.

your_shadow03 02-13-2009 02:18 AM

http://www.apacheweek.com/features/logfiles

routers 02-13-2009 02:19 AM

this is mine

<VirtualHost *:80>
ServerName linux.noc.net.my
ServerAdmin noc@NOSPAMipx.noc.net.my
DocumentRoot /home/linx/www
TransferLog /home/linx/logs/access-log
ScriptAlias /cgi-bin/ /home/linx/www/cgi-bin/
</VirtualHost>

FYI i symlink that www to public_html
look at access-log
hope u got idea

maas187 02-13-2009 03:09 AM

Quote:

Originally Posted by routers (Post 3441896)
this is mine

<VirtualHost *:80>
ServerName linux.noc.net.my
ServerAdmin noc@NOSPAMipx.noc.net.my
DocumentRoot /home/linx/www
TransferLog /home/linx/logs/access-log
ScriptAlias /cgi-bin/ /home/linx/www/cgi-bin/
</VirtualHost>

FYI i symlink that www to public_html
look at access-log
hope u got idea

thankx for the reply .

I used method. but it did not work.

i needed a method that would add error_log to all public_html in every users in my linux box.
exmaple..

/home/user1/public_html/logs/error_log
/home/user2/public_html/logs/error_log
and so on .. i dont really care for now if it would be identical.

thanx for the help again

routers 02-13-2009 03:54 AM

if you mean you want that error_log automaticaly add for every user
then look at /etc/skel , this skel helping me save my time when adduser i show mine

--------------
[root@noc ~]# ls -l /etc/skel/
total 8
drwxr-xr-x 2 root root 4096 Mar 20 2008 logs
drwxr-xr-x 3 root root 4096 Mar 20 2008 public_html
lrwxrwxrwx 1 root root 11 Mar 20 2008 www -> public_html
----------------------

when u adduser this skel will added all the file to user newly created

bathory 02-13-2009 04:59 AM

[Edit]
I think that the only way to achieve this is to use a script to grep for ~username the access.log and error.log and pipe the results into the respactive files in the user's homedir.
Of course you should do this for any user.

your_shadow03 02-13-2009 06:27 AM

/etc/skel !!!! How can it come into picture?

routers 02-13-2009 07:17 AM

its work this way , look at my config

<VirtualHost *:80>
ServerName linux.noc.net.my
ServerAdmin noc@ipx.noc.net.my
DocumentRoot /home/linx/www
TransferLog /home/linx/logs/access-log
ErrorLog /home/linx/logs/error_log
ScriptAlias /cgi-bin/ /home/linx/www/cgi-bin/
</VirtualHost>
__________________

look at the ErrorLog directive, try simply hit non exist file to the last url
i got the error msg at error_log

maas187 02-13-2009 04:31 PM

Quote:

Originally Posted by routers (Post 3442147)
its work this way , look at my config

<VirtualHost *:80>
ServerName linux.noc.net.my
ServerAdmin noc@ipx.noc.net.my
DocumentRoot /home/linx/www
TransferLog /home/linx/logs/access-log
ErrorLog /home/linx/logs/error_log
ScriptAlias /cgi-bin/ /home/linx/www/cgi-bin/
</VirtualHost>
__________________

look at the ErrorLog directive, try simply hit non exist file to the last url
i got the error msg at error_log

thank you very much for your reply.
but i tried that with my apache. for some reason it dose not work.
and + i dont want to use Vitual Host for port 80. i have the default setting and its working fine.

if there is a way so i could redirect error_log to all users.

and thank for even recommended /etc/skel , very nice trick. :)

thanks again guys.

maas187 02-13-2009 04:32 PM

I was thinking about using the Mysql_mob and make it accessble for all users. any suggestions ??

routers 02-13-2009 08:47 PM

you still can use the port you want just leave the current your use port
as it , the only thing is ErrorLog will work per-user with that way,

btw i not sure what is mysql_mob about and trying to google but not even one word reply to me from that search :)

maas187 02-14-2009 01:53 AM

Quote:

Originally Posted by routers (Post 3442867)
you still can use the port you want just leave the current your use port
as it , the only thing is ErrorLog will work per-user with that way,

btw i not sure what is mysql_mob about and trying to google but not even one word reply to me from that search :)

-------------------------------------
As a result i created a page that would be accesble by users to log on to and check the log for now. its working fine.


and about the mysql_mob. here you go the simple steps done on Fedora machine as an example.

1 - yum install httpd-devel mysql-devel make bzip2
2 - wget http://www.outoforder.cc/downloads/m...-1.101.tar.bz2
3 - tar xvjf mod_log_sql-1.101.tar.bz2
4 - cd mod_log_sql-1.101
5 - ./configure
6 - gmake
7 - gmake install
8 - /etc/init.d/mysql start or service mysqld start
9 - log on mysql with root and run this command.
a - create database apachelogs;
b - use apachelogs
c - source /"path"/mod_log_sql/contrib/create_table.sql
where "path" is the path for the mod_log_sql folder unzipped, which would create tables and fields.
d - grant insert,create on apachelogs.* to 'loguser'@'localhost' identified by 'password' ;
e - flush privileges ;
10 - vi /etc/httpd/conf/httpd.conf and add the following lines in the mod section in the conf file.
a - LoadModule log_sql_module modules/mod_log_sql.so
b - LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
c - LogSQLLoginInfo mysql://loguser:password@localhost/apachelogs
d - LogSQLDBParam socketfile /var/lib/mysql/mysql.sock
e - LogSQLCreateTables on
11 - comment out access_log and Error_log and add those two lines.
a - LogSQLTransferLogTable access_log
b - LogSQLTransferLogFormat AabcfHhIlMmPpRrSsTtUuvio

it should look like something like this.

DocumentRoot /var/www/html/
ServerName yourdomain.com
#ErrorLog logs/youdomain.com-error_log
#CustomLog logs/yourdomain.com-access_log common
LogSQLTransferLogTable access_log
LogSQLTransferLogFormat AabcfHhIlMmPpRrSsTtUuvio
12 - finally , service httpd restart , or /etc/init.d/httpd restart

and you should be fine.

:)
Regards,
MaaS

routers 02-14-2009 02:20 AM

this is new things to me , i will setup vps just for test this mysql_mod..
and follow your step , this new things to learn good knowledge exchange :)
thanks


All times are GMT -5. The time now is 04:39 PM.