How to write the RDB-Manager log (arc_log table) to a logfile or datapoints...


The RDB Manager writes log entries to a database table - arc_log - which is maybe not monitored by someone... With a simple control script you can write the logs to a normal WinCCOA logfile or set the messages to datapoints... with an alert handling. In that example the check is done periodically every 5 seconds:


main()
{
  int i;
  string max_id;
  dyn_dyn_anytype res;
  runRealSQLQuery("SELECT MAX(arc_log_id) FROM arc_log", res);
  if ( dynlen(res)==0 ) exit;
  max_id=res[1][1];
  while ( true ) {
    runRealSQLQuery("SELECT arc_log_id, ts, program, type, ora_code, info, errorstack, job_id FROM arc_log WHERE arc_log_id > "+max_id+" ORDER BY arc_log_id", res);
    for ( i=1; i<=dynlen(res); i++ ) {
      max_id=res[i][1];
      DebugN(res[i]);  // write to log file or set it to datapoints
    }
    delay(5);
  }
}
Last update:
2014-09-09 22:33
Author:
Andreas Vogler
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.