====Event Substitutions====
Some [[event log|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|MySQL/MariaDB]], or to messaging outputs such as [[evemail|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. The substituted text must be in //uppercase// and have percentage signs on //both sides//.
===Example===
For example, if you were record a //Door Closed// 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')