473,320 Members | 1,867 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.

Effective way to read and write into syslog in Linux systems usingC++

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 processes.
ideally the CPU utilization has to be only max of 10% not more.
I have used getline() for reading.
I hope u will please provide me a suitable solution.

Thanks
Anjali
Jun 27 '08 #1
1 2832
an**********@gmail.com writes:
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 processes.
ideally the CPU utilization has to be only max of 10% not more.
I have used getline() for reading.
I hope u will please provide me a suitable solution.
Of course, you can always throttle the CPU usage by your process, but
what good would that be to have your processor 70% idle?

Just tell the kernel that your log analysis process is not prioritary,
and let the scheduler allocate the time available.

nice -5 log-analyzer &
other-processes &
top
Now, one good way to limit the CPU usage of log processing is to NOT
write any logs.

Note that reducing the log level at the syslog step is already too
late. At least, with syslog-ng, when I activate debugging logs with
no destination for them, syslog-ng still takes 20% CPU, doing nothing
more than /dev/null. (Of course, you can assume that the driver is
also taking 20% CPU only to send the logs).
--
__Pascal Bourguignon__
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

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...
11
by: Sebastian Krause | last post by:
Hello, I tried to read in some large ascii files (200MB-2GB) in Python using scipy.io.read_array, but it did not work as I expected. The whole idea was to find a fast Python routine to read in...
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....
6
by: Rolf Schroedter | last post by:
(Sorry for cross-posting). I need to access large files > 2GByte (Linux, WinXP/NTFS) using the standard C-library calls. Till today I thought I know how to do it, namely for Win32: Use open(),...
2
by: hezhenjie | last post by:
Hi, all: I just need to parse a unicode file, and assume to get data one line by one line. I use _wfopen(), fgetws(), wcslen(), wcsstr(), making it work normally on Windows platform. However,...
44
by: Josh Mcfarlane | last post by:
Just out of curiosity: When would using std::list be more efficient / effective than using other containers such as vector, deque, etc? As far as I'm aware, list doesn't appear to be...
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...
7
by: johnhelen | last post by:
hello In a perl script for a cronjob, there is a function: sub _write_sys_log { my $seft = shift; my $level = shift; my $string = shift; syslog($level, '%s', "$string");
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...
1
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...
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.