Пример #1
0
static gboolean
msg_limit_internal_message(const gchar *msg)
{
  MsgContext *context;

  if (!evt_context)
    return FALSE;

  context = msg_get_context();

  if (context->recurse_state >= RECURSE_STATE_SUPPRESS)
    {
      if (!context->recurse_warning)
        {
          msg_event_send(
            msg_event_create(EVT_PRI_WARNING,
                             "internal() messages are looping back, preventing loop by suppressing all internal messages until the current message is processed",
                             evt_tag_str("trigger-msg", context->recurse_trigger),
                             evt_tag_str("first-suppressed-msg", msg),
                             NULL));
          context->recurse_warning = TRUE;
        }
      return FALSE;
    }
  return TRUE;
}
Пример #2
0
gboolean
msg_limit_internal_message(void)
{
    MsgContext *context;

    if (!evt_context)
        return FALSE;

    context = msg_get_context();

    if (context->recurse_count > MAX_RECURSIONS)
    {
        if (!context->recurse_warning)
        {
            msg_event_send(
                msg_event_create(EVT_PRI_WARNING, "syslog-ng internal() messages are looping back, preventing loop by suppressing further messages",
                                 evt_tag_int("recurse_count", context->recurse_count),
                                 NULL));
            context->recurse_warning = TRUE;
        }
        return FALSE;
    }
    return TRUE;
}