This is an old revision of the document!
Event Substitutions
Some event output modules allow you to substitute special patterns with details of the event.
This is particularly common in SQL-based outputs, such as those to MySQL/MariaDB, or to messaging outputs such as Email.
The following table shows the substitutions available…
Pattern | Substituted With |
---|---|
%S | The start date and time |
%E | The end date and time |
%D | The total duration (usually in seconds) |
%M | The log message |
%TAGS | A comma-delimited list of tags |
The options passed to the Write function can also be accessed. If you called Write with an option of 'unit', any occurrence of %UNIT would be replaced with the unit ID.
Example
For example, if you were record a Door Open event on the 10th of December 2035, your SQL statement that looked like this…
INSERT INTO events (start,end,message) VALUES ('%S','%E','%M')
would be transformed into this…
INSERT INTO events (start,end,message) VALUES ('2035-12-10 09:00:00','2035-12-10 09:00:00','Door Closed')