Package rrlog :: Package contrib :: Module catarch :: Class CatArchiver
[hide private]
[frames] | no frames]

Class CatArchiver

source code

object --+
         |
        CatArchiver
Known Subclasses:

Archives log lines of defined categories (i.e.rescues them from log rotation.)


Attention:
Instance Methods [hide private]
 
__init__(self, server, minArchCount=10, minClientArchCount=1, cats=None, maxCount=10000)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_dictFromJob(self, job)
row supports the dict interface but unfortunately, sometimes we need a real dict
source code
 
_writeMeta(self, trigger_id, clientid, msgid)
hook, override to write meta data (one line for each problem) #todo: inconsistent col names (suffixed by both "id" and "_id")
source code
int
_next_trigger_id(self, ospid)
Alternative: Make the meta table mandatory and use an auto increment column for db-unique ids.
source code
 
observe(self, jobhist, writer)
The log observer protocol
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, server, minArchCount=10, minClientArchCount=1, cats=None, maxCount=10000)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • minArchCount - >=1,default: 10. This is the count of messages that are at least archived along with any problem message (the problem message itself included.) Note 1: When a problem is archived shortly after another, no messages are saved twice even if the "preceding messages" intervals overlap. Note 2: The effective number of archived lines is limited by the cached jobs (job history) of the server. See LogServer parameters.
  • minClientArchCount - >=1, default: 1. This is analogous but addresses messages with the same client id as the "trigger message". The intention is that we often want to save more preceding messages that concern the "problematic" client only. Note: Unlike with minArchCount, messages are archived twice when the "preceding messages" intervals overlap, i.e. when problems are logged shortly after each other.
  • cats - list of cat; I archive log entries when cat is in this list.Default is "E","I","S" (These are speaking keys meaning: Error,InternalError,SecurityIssue. Adapt it to your convention.)
  • maxCount - max. problem count per archiver process. Subsequent problems are ignored. Note that the size of the archive (and meta table) can be limited this way, but since the limit is per-process, the max row count of the meta table can be number-of-processes * maxCount ! (We may consider to make the meta table mandatory; then we always could query the table size there just to ensure it does not grow too big. But it seems not worth the effort.)
Overrides: object.__init__

_next_trigger_id(self, ospid)

source code 

Alternative: Make the meta table mandatory and use an auto increment column for db-unique ids. But support for some DBs is not clearified yet.

Returns: int
database-unique id of the archive-triggering message Currently,composed of os-pid and Per-Process Trigger ID

observe(self, jobhist, writer)

source code 

The log observer protocol

Parameters:
  • jobhist - list,len>=1,ordered recent jobs, [-1] is the lastest (i.e.current).
  • writer - unused. The jobhist only is used for archiving.
Raises: