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
bashly
Posts: 8
Joined: Wed Dec 24, 2014 7:25 pm
Skillset: ISPF, TSO, C/C++ compiling, networking
Referer: Internet

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?

steve-myers
Global moderator
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Skillset: Assembler, JCL, utilities
Referer: zos.efglobe.com

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.

bashly
Posts: 8
Joined: Wed Dec 24, 2014 7:25 pm
Skillset: ISPF, TSO, C/C++ compiling, networking
Referer: Internet

Re: Getting SYSLOG records from C app

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

Thank you, Steve!

  • Similar Topics
    Replies
    Views
    Last post