<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
span.EmailStyle20
{mso-style-type:personal-compose;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoPlainText>I'm new to syslog-ng OSE. I've been able to follow the samples, and configured an email alert when a syslog message is received.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Now I'm trying to configure an email alert when it has been too long since I've received a particular syslog message. <o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>First, I configured a destination:<o:p></o:p></p><p class=MsoPlainText> destination d_heartbeat { <o:p></o:p></p><p class=MsoPlainText> file("/var/log/heartbeat.log" mark-freq(60) mark-mode(dst-idle) );<o:p></o:p></p><p class=MsoPlainText> };<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Then, I configured a filter and log:<o:p></o:p></p><p class=MsoPlainText> filter f_heartbeat {<o:p></o:p></p><p class=MsoPlainText> match("I am still here" value("MESSAGE) );<o:p></o:p></p><p class=MsoPlainText> };<o:p></o:p></p><p class=MsoPlainText> Log { source(s_network); filter(f_heartbeat); destination(d_heartbeat); };<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I was pleasantly surprised that this worked. The heartbeat.log file received the message, and 60 seconds later it received the "syslog -- MARK --"<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Since I wanted an email alert, I defined a new source, to grab the output of my heartbeat.log as input:<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText> source s_heartbeat { file(""/var/log/heartbeat.log"); };<o:p></o:p></p><p class=MsoPlainText> destination d_smtp { smtp(<o:p></o:p></p><p class=MsoPlainText> host("10.10.10.25") port(25)<o:p></o:p></p><p class=MsoPlainText> from("syslog-ng" "<a href="mailto:noreply@mydomain.com">noreply@mydomain.com</a>")<o:p></o:p></p><p class=MsoPlainText> to("me" "<a href="mailto:myemail@mydomain.com">myemail@mydomain.com</a>")<o:p></o:p></p><p class=MsoPlainText> subject("host is down")<o:p></o:p></p><p class=MsoPlainText> body("no heartbeat received from the program on host\n")<o:p></o:p></p><p class=MsoPlainText> ); };<o:p></o:p></p><p class=MsoPlainText> filter f_timeout { match ("MARK --" value("MESSAGE")); };<o:p></o:p></p><p class=MsoPlainText> log { source(s_heartbeat); filter(f_timeout); destination(d_smtp); };<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>This seemed to work when I tested it with a single heartbeat followed by timeout, but I’m still misunderstanding something. If it gets more than one message written to heartbeat.log, then the timeout MARK doesn’t happen.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>What am I missing? Is there a better way to accomplish this alert?<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>Thanks,<o:p></o:p></p><p class=MsoPlainText>Gregg<o:p></o:p></p><p class=MsoPlainText>(running syslog-ng v3.19.1-5 on debian 10)<o:p></o:p></p></div></body></html>