vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi all. On AIX, Stream-drivers' log messages goe in /var/adm/streams/error.mm-dd. I have to do similar stuff, but from shell scripts. I know there is one "logger" command, but could not find an option in logger command to log the messages from the scripts to these files. Could somebody help? Thanks in advance, -KC |
| |||
| kcnainwal@gmail.com <kcnainwal@gmail.com> wrote: > On AIX, Stream-drivers' log messages goe in > /var/adm/streams/error.mm-dd. I have to do similar stuff, but from > shell scripts. I know there is one "logger" command, but could not find > an option in logger command to log the messages from the scripts to > these files. > > Could somebody help? logger reports a message to syslogd, and what happens with the message is not logger's problem. What you need to do is configure syslogd so that it writes your messages to the file you want. You will have to edit /etc/syslog.conf and then send syslogd a signal -1 to inform it of the changes. Read the man page for syslog.conf. Yours, Laurenz Albe |
| |||
| Thanks Laurenz, Yes, you're right. I know one needs to edit syslog.conf file in order to direct the log messages. I think you don't get my problem. Ok, here I try again. There are 2 problems with what you're suggesting- 1) I want the output in the /var/adm/streams/error.mm-dd file (which is the streams log file), and this is not a single file. It keeps changing with days. For each day (of each month) a new file get s created. So if I want a log today, it would be in the file "/var/adm/streams/error.11-29", and if I want it tomorrow, then it should be in "/var/adm/streams/error.11-30". Now there is no way (as far as I know) we can specify this kind of requirement in syslog.conf file. 2) I'm creating this shell script for an end-user, whose machine might be configured with different logging options, and who probably don't want to change those settings. What I want is a one-shot solutions (without changing any of the existing system logging settings). I've done this inside the driver using strlog() routine. What I want is an equivalent from the command line. Thanks, -KC |
| |||
| kcnainwal@gmail.com <kcnainwal@gmail.com> wrote: > Yes, you're right. I know one needs to edit syslog.conf file in order > to direct the log messages. I think you don't get my problem. Ok, here > I try again. > There are 2 problems with what you're suggesting- > > 1) I want the output in the /var/adm/streams/error.mm-dd file (which is > the streams log file), and this is not a single file. It keeps changing > with days. For each day (of each month) a new file get s created. So > if I want a log today, it would be in the file > "/var/adm/streams/error.11-29", and if I want it tomorrow, then it > should be in "/var/adm/streams/error.11-30". Now there is no way (as > far as I know) we can specify this kind of requirement in syslog.conf > file. > 2) I'm creating this shell script for an end-user, whose machine might > be configured with different logging options, and who probably don't > want to change those settings. What I want is a one-shot solutions > (without changing any of the existing system logging settings). > > I've done this inside the driver using strlog() routine. What I want is > an equivalent from the command line. I see. That cannot be done with syslog, especially not without modifying the configuration. Since you are writing shell scripts, I'd suggest that you use something else than logger to log messages. What keeps you from using something like echo "message to log" >>$logfile in your shell script? I am sure you thought of that, so please explain why you think that this solution is inappropriate. Is it because you want to write to a destination where the user may not write? If that's the case, you will not get away without modifying something on the user's machine. Yours, Laurenz Albe |
| ||||
| The problem with "echoing" into that file is that this script is not the only one writing into the file. There are other drivers, kernel extensions etc writing into that file...and by doing echo, we probably end up with intermingled contents. Thanks anyway for the help -KC |