Page 1 of 1

Getting SYSLOG records from C app

PostPosted: Wed Dec 24, 2014 7:34 pm
by bashly
Hi!
How can I read SYSLOG/OPERLOG/Console log records in my c/c++ application?
I can write to LOG using syslog() function, but is there any method to read the LOG programmatically?

Re: Getting SYSLOG records from C app

PostPosted: Wed Dec 24, 2014 9:20 pm
by steve-myers
Technically, yes. In theory - I've never done it - you can allocate the SYSLOG using dynamic allocation. You will have to use some of the fancier subsystem functions to get its JES2 "data set name." Once it is allocated you can read it using standard C functions like fopen / fgets.

When I want SYSLOG for analysis I use SDSF to "print" it to a data set, then read the data set. If the log has already been moved off JES2, you can read the data sets where it has been moved to. If you choose to use this method I strongly recommend that you "print" it to a data set allocated with variable length records. The data set will be much smaller, which should make your analysis program much faster.

Re: Getting SYSLOG records from C app

PostPosted: Mon Jan 19, 2015 4:55 pm
by bashly
Thank you, Steve!