Getting SYSLOG records from C app



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

Getting SYSLOG records from C app

Postby bashly » Wed Dec 24, 2014 7:34 pm

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?
bashly
 
Posts: 8
Joined: Wed Dec 24, 2014 7:25 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Getting SYSLOG records from C app

 

Re: Getting SYSLOG records from C app

Postby steve-myers » Wed Dec 24, 2014 9:20 pm

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.
steve-myers
Global moderator
 
Posts: 2047
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 223 times

Re: Getting SYSLOG records from C app

Postby bashly » Mon Jan 19, 2015 4:55 pm

Thank you, Steve!
bashly
 
Posts: 8
Joined: Wed Dec 24, 2014 7:25 pm
Has thanked: 0 time
Been thanked: 0 time


Return to C, C++

 


  • Related topics
    Replies
    Views
    Last post