Report Template: Simple Counters
Count how many stored messages contain each keyword.
Initialization (SQL commands)
CREATE TABLE Counters (Name TEXT PRIMARY KEY, Value INTEGER);
INSERT INTO Counters (Name, Value) VALUES
('Keyword1', 0),
('Keyword2', 0);
For Each Message
Two commands, one per keyword.
SQL:
UPDATE Counters SET Value = Value + 1 WHERE Name = 'Keyword1';
Execute for:
{MESSAGE} CONTAINS "Keyword1"
Repeat for Keyword2.
Finalization is not required.
Report file contents
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Syslog report: Counters</title>
</head>
<body>
<h1>Syslog report: Counters</h1>
<p>{FROM|%F %T} - {TO|%F %T}</p>
<ul>
<li>Keyword1:
{{EXECUTE SELECT Value FROM Counters WHERE Name='Keyword1';}}
{0}
{{END}}
</li>
<li>Keyword2:
{{EXECUTE SELECT Value FROM Counters WHERE Name='Keyword2';}}
{0}
{{END}}
</li>
</ul>
</body>
</html>