| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-13-2010, 02:14 AM
|
#1
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Rep:
|
syslog stops writing in log
syslog stops writing immediately after log rotation, after I start the system (but not after reboot), and at some other times, into my fast cgi application's log. It starts working after /etc/init.d/sysklogd restart. Please give me any hint.
Configuration:
I am using Ubuntu 8.04 lts server, Apache web server.
My (fast cgi) application uses:
Code:
#include <syslog.h>
syslog(LOG_LOCAL6|LOG_INFO, "new n= %d;\n", count);
to log some activity messages.
At the end of /etc/syslog.conf I added:
Code:
local6.=info -/var/log/apache2/myapp.log
In /etc/syslog.conf I added to each selector which contained "myapp.log":
like this:
Code:
*.*;auth,authpriv.none;local6.!=info -/var/log/syslog
and:
Code:
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none;local6.!=info -/var/log/messages
Last edited by doru; 09-13-2010 at 02:22 AM.
|
|
|
|
09-16-2010, 03:08 AM
|
#2
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Original Poster
Rep:
|
It seems that syslog ceases to function when syslogd is restarted automatically. This happens when I start or reboot the computer and when logs are rotated. After I:
Code:
/etc/init.d/sysklogd restart
it all goes well. This is true for my fcgi application only, other system pre-configured logs work fine.
fflush(NULL); and closelog(); do not seem to make any difference.
I was amazed today to discover that:
Code:
wget localhost/myapp.fcgi?some%20data
issued locally as root is logged well after I started the system, but access requests from other locations were not logged unless I did /etc/init.d/sysklogd restart.
And this is also a BUMP.
Doru
|
|
|
|
09-17-2010, 03:20 AM
|
#3
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Original Poster
Rep:
|
I modified:
/etc/init.d/sysklogd reload-or-restart > /dev/null
into:
/etc/init.d/sysklogd restart > /dev/null
in:
/etc/cron.{weekly,daily}/sysklogd
and now I got it going, I believe. However, I don't like this solution, because I don't know what is going on here.
Other people have got the same problem:
http://www.linuxquestions.org/questi...8-04-a-703386/
Doru
|
|
|
|
09-19-2010, 11:31 PM
|
#4
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Original Poster
Rep:
|
The solution in my last post seems to be working. It works after the daily rotation. Thank you, Doru!
Doru
|
|
|
|
09-19-2012, 10:12 AM
|
#5
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Original Poster
Rep:
|
In short, I print into some /var/log/apache2/myapp.log file from a fcgi application under apache. You can see the configuration changes which I performed in the first post.
As a result:
in /etc/cron.daily/sysklogd:
Code:
/etc/init.d/sysklogd reload-or-restart > /dev/null
calls:
in /etc/init.d/sysklogd:
Code:
sudo start-stop-daemon --stop --quiet --signal 1 --pidfile /var/run/syslogd.pid --name syslogd
and myapp.fcgi stops writing to myapp.log and it stays like that.
I changed:
in /etc/cron.daily/sysklogd:
Code:
/etc/init.d/sysklogd restart > /dev/null
and now:
Code:
sudo logrotate -f /etc/logrotate.conf
restarts all apache2 processes excepting one and kills myapp.fcgi.
It appears that the combination of apache2, fcgi and syslog makes a perfect mess of my logging. Of course, all system and apache2 native logging works flawlessly. Anybody with some experience in linux, please give me any advice. Do I have a chance to solve this?
|
|
|
|
09-23-2012, 11:53 AM
|
#6
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Original Poster
Rep:
|
|
|
|
|
09-24-2012, 09:42 AM
|
#7
|
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,314
|
I would suggest to use the system logging facility in your myapp.fcgi and combine the two sources in the syslog facility you use.
|
|
|
|
10-03-2012, 06:48 AM
|
#8
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Original Poster
Rep:
|
Quote:
Originally Posted by Reuti
I would suggest to use the system logging facility in your myapp.fcgi and combine the two sources in the syslog facility you use.
|
Thank you for your answer.
Am I not using the system logging facility already, since I call syslog?
I don't understand what two sources in the syslog facility should I combine? I call syslog from myapp.fcgi, in C++.
|
|
|
|
10-11-2012, 11:27 AM
|
#9
|
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,314
|
I’m quite confused what I had in mind too. What is your definition for the logrotation of the log files in /etc/logrotate.d.
|
|
|
|
11-07-2012, 06:15 AM
|
#10
|
|
Member
Registered: Sep 2008
Distribution: Ubuntu 8.04 LTS Server
Posts: 84
Original Poster
Rep:
|
Quote:
Originally Posted by Reuti
I’m quite confused what I had in mind too. What is your definition for the logrotation of the log files in /etc/logrotate.d.
|
Code:
/etc/logrotate.d$ cat apache2
/var/log/apache2/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
/etc/init.d/apache2 reload > /dev/null
fi
endscript
}
To summarize my two problems, with solutions at the end of each problem description:
Quote:
in /etc/cron.{daily,weekly}/sysklogd (the original):
/etc/init.d/sysklogd reload-or-restart > /dev/null
in /etc/init.d/sysklogd
sudo start-stop-daemon --stop --quiet --signal 1 --pidfile /var/run/syslogd.pid --name syslogd
prevents myapp.fcgi from writing into myapp.log any longer (but access.log is still written), even if you do sudo start-stop-daemon --start --quiet --pidfile /var/run/syslogd.pid --name syslogd --startas /sbin/syslogd, which anyway is not done in the script.
in /etc/cron.{daily,weekly}/sysklogd I did:
/etc/init.d/sysklogd restart > /dev/null
in /etc/cron.daily/logrotate:
sudo logrotate -f /etc/logrotate.conf restarts all apache processes excepting one and kills myapp.fcgi. It changes permissions of myapp.log into root.adm, which are corrected back into syslog.adm in /etc/cron.daily/sysklogd by /etc/init.d/sysklogd restart. The correction takes place in /etc/init.d/sysklogd. In the meantime, myapp.fcgi can not write into myapp.log.
in /etc/cron.daily/logrotate I did:
if ! ps -A | grep fcgi > /dev/null; then
/usr/sbin/logrotate /etc/logrotate.conf; fi
to rotate only when no fcgi process is running.
the other solution to the second problem, to catch the termination signal in myapp.fcgi and to save the state such that later I can restore it when myapp.fcgi is restarted, could still lose one or more access requests and it requires too much work. Plus, it would have to be done for all fcgi's.
|
Last edited by doru; 11-07-2012 at 06:18 AM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:50 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|