LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-12-2009, 11:20 PM   #1
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 225

Rep: Reputation: 32
Question 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.
 
Old 02-13-2009, 01:18 AM   #2
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Blog Entries: 6

Rep: Reputation: 51
http://www.apacheweek.com/features/logfiles
 
Old 02-13-2009, 01:19 AM   #3
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 787
Blog Entries: 6

Rep: Reputation: 75
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
 
Old 02-13-2009, 02:09 AM   #4
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 225

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by routers View Post
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
 
Old 02-13-2009, 02:54 AM   #5
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 787
Blog Entries: 6

Rep: Reputation: 75
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
 
Old 02-13-2009, 03:59 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
[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.

Last edited by bathory; 02-13-2009 at 05:53 AM.
 
Old 02-13-2009, 05:27 AM   #7
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,466
Blog Entries: 6

Rep: Reputation: 51
/etc/skel !!!! How can it come into picture?
 
Old 02-13-2009, 06:17 AM   #8
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 787
Blog Entries: 6

Rep: Reputation: 75
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
 
Old 02-13-2009, 03:31 PM   #9
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 225

Original Poster
Rep: Reputation: 32
Wink

Quote:
Originally Posted by routers View Post
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.
 
Old 02-13-2009, 03:32 PM   #10
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 225

Original Poster
Rep: Reputation: 32
I was thinking about using the Mysql_mob and make it accessble for all users. any suggestions ??
 
Old 02-13-2009, 07:47 PM   #11
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 787
Blog Entries: 6

Rep: Reputation: 75
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
 
Old 02-14-2009, 12:53 AM   #12
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 225

Original Poster
Rep: Reputation: 32
Wink

Quote:
Originally Posted by routers View Post
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://loguserassword@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
 
Old 02-14-2009, 01:20 AM   #13
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 787
Blog Entries: 6

Rep: Reputation: 75
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache error_log [] file does not exist wanghao Linux - Server 2 11-29-2007 09:27 AM
How to diagnose: Apache exit(1) with empty error_log sundialsvcs Linux - Software 1 09-07-2007 08:08 AM
apache error_log always full Suinatsa Linux - Software 1 07-21-2006 03:44 AM
Apache error_log Sapient Linux - Software 1 12-31-2005 08:10 PM
a better php/apache error_log joe.biz Linux - Software 1 10-27-2005 06:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration