Manish, If you want to read log files generated by syslogd on the fly, what you can do is that ask syslogd to log the messages for facility.priority that you are interested in to a named pipe or [as Sapansuggested] to a psuedo master device.
You can get info about how to do this from man syslog.conf. For e.g. if you want to catch all messages with MAIL as the facility, you could do something like: <config> mail.* /var/log/maillog mail.* /dev/ptyp8 #This is just an example, you have to check things for your system more carefully. </config> The above two lines when placed in you /etc/syslog.conf [or equivalent] file will cause all the messages for the MAIL facility to be stored in /var/log/maillog, as well as being fed to /dev/ptyp8. And then within the C program read from the /dev/ttyp8 file. You will have to develop a mechanism to search for only the relevant entries that your are looking for etc. If you are interested in messaged generated by the kernel, you can directly peek into the kernel message ring buffer - try man 2 syslog. If you ware only interested in looking at messages from a specific application, it would be *far* more efficient to look at the documentation for that application and use some specific hack. Regards, -Varun On Fri, Mar 29, 2002 at 07:06:44PM +0530, Manish K Arya spoke out thus: > Hi > how can i read logs dynamically in C. like if i do tail -f <logfile> output goes >to stdout.i want same kind of mechenism to read log files in C. > > bye > --- > Manish Kumar Arya > > > > See Dave Matthews Band live or win a signed guitar > >http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp > > > _______________________________________________ > linux-india-programmers mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/linux-india-programmers -- -------------------------------------- Mindframe Software & Service Pvt. Ltd. http://www.mindsw.com -------------------------------------- ================================================ To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org =================================================