Alarm Logging with TAlh

Home
The -l Command Line Switch
Alarm Logging to Log-Files - the FileAlarmLogger Plugin
    Log File Names
Alarm Logging to a Postgresql Database - the PsqlAlarmLogger Plugin

TAlh uses Qt plugins to log alarms. See the section Installing and Running TAlh for plugin location.

The -l Command Line Switch

The command line switch -l specifies which plugin is loaded and which parameters are passed to the plugin.

If no -l switch is given alarm logging is not available. A warning message is displayed.

The value of the -l switch may contain a list of comma-separated or white-space-separated items. The first item is taken as a plugin name prefix. The other list items must be name/value pairs of the format <name>=<value>. They are comma-catenated and the resulting parameter string is passed to the plugin.

In the value of the -l switch contains neither comma nore white space the value is taken as a plugin name prefix.

TAlh  searches for a logging plug-in with the name <prefix>AlarmLogger in the operating system specific plugin directory.

Alarm Logging to Log-Files - the FileAlarmLogger Plugin


The TAlh distribution contains a plugin "FileAlarmLogger" which logs to files in a format very similar to alh. Both an alarm log file and an operatior actions log file are written.

The value of the -l switch contains two items:
  1. "File"   the plugin name prefix
  2. <info> log file info

Log File Names

If <info>  is 'default'  or an empty string  the log files have the form  talh.log.<date>  and talh.opmod.<date>, i.e if TAlh is started on Dec 10, 2016 the logfiles would be
talh.log.20161210  and talh.opmod.20161210.

If <info> ends with a /  the log files have the form   <instance>.log.<date>  and <instance>.opmod.<date>, where <instance> is the alarm handler instance which is specified in the alarm configuration file with the keyword $INSTANCE.  If no $INSTANCE is present <instance> is set to 'talh'. i.e, if $INSTANCE = talh3 and TAlh is started on Dec 11, 2016, the log files would be

talh3.log.20161211  and talh3.opmod.20161211

If the path does not end with a / the part following the last / is taken as a file prefix overriding any other prefix  i.e. the switch

-l File,/usr1/project/talh/log/handler1
  

on Dec 14, 2016 will result in the file set

handler1.log.20161214  and handler1.opmod.20161214.

At midnight (local time) the FileAlarmLogger plugin will close the log file set and open a new one with updated date in the name.


Alarm Logging to a Postgresql Database - the PsqlAlarmLogger Plugin


The TAlh distribution contains a plugin "PsqlAlarmLogger" which logs to a relational database.
The value of the -l switch must contain "Psql" as the first item, followed by the name/value pairs:
server=<database server>
port=<tcp/ip port>
dbname=<database name>
schema=<database schema>
table=<database table>
user=<database login name>
user2=<database login password>
cash=<list limit>*

The cash parameter sets a limit for the length of logging sets which are transferred to the logger several times per second. If the logging set has more than <list limit> alarms, the alarms are cashed, i.e. the list is analyzed and alarms originating from the same PV are dropped with the exception of the last one. The number of dropped alarms is logged.
This reduces the susceptilbility of TAlh to alarm storms.

Command line example:
-l Psql,server=dbs.triumf.ca,dbname=operations,schema=alarmlog,table=cyclotron,user=rolf,user2=......,cash=100.

The plugin logs both alarms and operator actions into a database table which is created with the following SQL statement:
CREATE TABLE alarmlog.test
(
    alarmtime timestamp NOT NULL,
    logtype_id integer NOT NULL,
    pv varchar(100),
    sevr varchar(10),
    acks varchar(10),
    state varchar(50),
    ackt varchar (10),
    val varchar (50),
    ioctime bigint,
    msg varchar(500),
    CONSTRAINT fk_logtype_id FOREIGN KEY (logtype_id) REFERENCES alarmlog.logtype (logtype_id)
) with OIDS;

The logtype_id column in this table is a foreign key which is provided by a database table which is created by the following SQL statement
CREATE TABLE alarmlog.logtype
(
    logtype_id integer NOT NULL,
    logtype varchar(100) NOT NULL,
    CONSTRAINT pk_logtype_id PRIMARY KEY (logtype_id)
) with OIDS;

The  PsqlAlarmLogger plugin uses the following content of the logtype table:
# select * from logtype order by logtype_id;
 logtype_id |       logtype
------------+---------------------
          1 | alarm data
          2 | operator actions
          3 | alarm handler admin
(3 rows)




back to Table of Contents