473,320 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

syslog function try to write to /dev folder

hello

In a perl script for a cronjob, there is a function:

Expand|Select|Wrap|Line Numbers
  1. sub _write_sys_log {
  2. my $seft = shift;
  3. my $level = shift;
  4. my $string = shift;
  5. syslog($level, '%s', "$string");
  6. }
This function is called from other function. I think that the function above should write logs to syslog file. However, it tries to write logs to /dev/consolog. As /dev/consolog is own by root, so it cannot write logs to this file. Therefore, it throws an error.

My question is how I can write these logs to syslog file. I am not good in perl and I am not the person who wrote this script, so please have some suggestions

Many thanks
Oct 10 '07 #1
7 2543
numberwhun
3,509 Expert Mod 2GB
hello

In a perl script for a cronjob, there is a function:

Expand|Select|Wrap|Line Numbers
  1. sub _write_sys_log {
  2. my $seft = shift;
  3. my $level = shift;
  4. my $string = shift;
  5. syslog($level, '%s', "$string");
  6. }
This function is called from other function. I think that the function above should write logs to syslog file. However, it tries to write logs to /dev/consolog. As /dev/consolog is own by root, so it cannot write logs to this file. Therefore, it throws an error.

My question is how I can write these logs to syslog file. I am not good in perl and I am not the person who wrote this script, so please have some suggestions

Many thanks
I am going to take a guess here and say that in the script you are looking at, that they are using the Sys::Syslog module from CPAN. I say that because that is where I see the syslog() function defined.

That said, you should read that link as they probably have the open() function defined and pointing to the file it is trying to write to.

Also, I am guessing that you mean that this script is "run by the crontab". In that case, the reason they have this pointing to a root permission log is because when crontab jobs get run, it is the root user that is doing the executing.

Regards,

Jeff
Oct 10 '07 #2
Thank you, you right

I check and there is openlog call as:

openlog('NEW', '', 'local2);

Is it correct

Thanks
Oct 10 '07 #3
numberwhun
3,509 Expert Mod 2GB
Thank you, you right

I check and there is openlog call as:

openlog('NEW', '', 'local2);

Is it correct

Thanks
You may want to read the functions part of the documentation. The first function is openlog() which it says has 3 parameters, where yours only has 2.

Unfortunately I haven't used this module and am unfamiliar with any caveats it may have, but it does look like that needs to be fixed.

Regards,

Jeff
Oct 10 '07 #4
Thanks for very quick reply
I also I discover that the "local2" facility (inside openlog function) is not in the /etc/syslog.conf file. Do you think that is the problem too ???


---------------------------------
You may want to read the functions part of the documentation. The first function is openlog() which it says has 3 parameters, where yours only has 2.

Unfortunately I haven't used this module and am unfamiliar with any caveats it may have, but it does look like that needs to be fixed.

Regards,

Jeff
Oct 10 '07 #5
numberwhun
3,509 Expert Mod 2GB
Thanks for very quick reply
I also I discover that the "local2" facility (inside openlog function) is not in the /etc/syslog.conf file. Do you think that is the problem too ???


---------------------------------
I would say that is the problem. I would track it down and see if the facility is modifiable.
Oct 10 '07 #6
"I would track it down and see if the facility is modifiable"

You mean that I should add one entry into the syslog.conf

local2.* /var/logs/syslog

So the log message will be written into syslog file ?

Many thanks for great help
Oct 10 '07 #7
numberwhun
3,509 Expert Mod 2GB
"I would track it down and see if the facility is modifiable"

You mean that I should add one entry into the syslog.conf

local2.* /var/logs/syslog

So the log message will be written into syslog file ?

Many thanks for great help
Yes, that's exactly what I mean. Hope it works for you!

Regards,

Jeff
Oct 11 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Erich Trowbridge | last post by:
Has anybody seen this tool? It is awesome. check out http://vw.vermeer.org/ . It's a php front end for large-scale syslog deployments. It makes managing syslog in large networks a snap. The idea...
5
by: Micha³ Wo¼niak | last post by:
Hi again The Question of Logs, part II. :) What are the advantages/disadvantages of using syslog() to do the logging rather than writing the logs with fopen(), fwrite() and fclose()? What...
0
by: Stephen Touset | last post by:
--=-vqiBeaRpc7WKjfgJmDzK Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Is there now a way within MySQL to log to syslog? I was reading an archived email conversation...
1
by: Gregory Starck | last post by:
Hello, I'm having what seems to be a deadlock in syslog with the code (wich comes from a project I'm working on, but I've reduced the test case to its minimum) I put at the end of this messsage....
1
by: liujixuan | last post by:
I am a new bie of Python. I knew there is module for syslog of Linux, but I want to create a syslog server on the windows server like windows 2k or 2k3, to collect the log message sent from our...
1
by: J Rice | last post by:
I have a question: When should syslog.closelog() be called? I have a daemon that spends most of its time asleep and quiet, but writes messages to the mail log when active. Should I open the...
3
by: Troels Arvin | last post by:
Hello, On a server with DB2 v. 8.2, db2diag.log ran full, it seems (i.e. reached a size of 2GB). And it seems that in this case, DB2 started using syslog instead. I would actually like DB2 to...
1
by: anjaliraman2 | last post by:
Hi All, I am facing a problem of writing into and reading from syslog in Linux Enviornment using C++. The CPU utilization is extremely high of about 55% and is creating problems for other...
1
by: Lincoln Yeoh | last post by:
Hi, I've just started to learn python (I've been using perl for some years). How do I redirect ALL stderr stuff to syslog, even stderr from external programs that don't explicitly change their...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.