Добавьте в EPP такое правило:
Event: событие, которое генерирует LogWatch для этой строчки
Filtering script:
if (int($node->logMatchCount) > 3) {
$node->logMatchCount = 0;
return true;
}
$node->logMatchCount = int($node->logMatchCount) + 1;
return false;
Action: отсылка оповещения
Я бы еще добавил проверку времени (сбрасывать счетчик, если пршло больше X секунд – 600 в примере):
now = time();
if (now - int($node->logLastMatch) > 600 || int($node->logMatchCount) > 3) {
$node->logLastMatch = now;
$node->logMatchCount = 0;
return true;
}
$node->logLastMatch = now;
$node->logMatchCount = int($node->logMatchCount);
return false;
Как это работает:
Счетчик сохраняется в custom attribute для сервера, на котором котором произошло событие ($node).
$node->logMatchCount и $node->logLastMatch - это упрощенный доступ к custom attribute, альтернатива GetCustomAttribute($node, ...) и SetCustomAttribute($node, ...).
Конструкция int($node->logMatchCount) - для ситуации, когда артибута еще нет, и результат NULL, принудительный каст в int даст на выходе 0, который можно сравнивать с другим числом (вместо конструкции вида "if ($node->logMatchCount != NULL && $node->logMatchCount > 3)").