[Exim] [Feature-Request] syslog from filter files

Top Page
Delete this message
Reply to this message
Author: Heinz Ekker
Date:  
To: exim-users
Subject: [Exim] [Feature-Request] syslog from filter files
Hi!

We have Exim running on multiple servers. Users can create their own
filters via a web interface, which generates an Exim filter file.

For customer care and statistic purposes, each filter action writes a
log line about what it did to which message. This works quite nicely,
but I couldn't find a possibility to do this via syslog to our central
log host.

So I wrote a small (but crude) patch to do this. If you specify

logfile "syslog"

all output from logwrite is now sent via syslog.

Is it possible to incorporate this or a similiar feature into Exim? Or
does anybody see another possibility to achieve that?

TIA,he

Patch:

*** exim-4.12/src/filter.c.orig    Wed Dec 18 11:28:02 2002
--- exim-4.12/src/filter.c    Sat Jul 12 14:30:01 2003
*************** while (commands != NULL)
*** 1980,1985 ****
--- 1980,1990 ----
        log_fd = -1;
        }
      log_filename = expargs[0];
+     // ekk
+     if (Ustrncmp(log_filename, "syslog", 6) == 0) {
+         log_fd = -2;
+         openlog("exim", LOG_PID, LOG_MAIL);
+     }
      if (filter_test != NULL)
        {
        indent();
*************** while (commands != NULL)
*** 2013,2019 ****
        int len;
        DEBUG(D_filter) debug_printf("writing filter log as euid %ld\n",
          (long int)geteuid());
!       if (log_fd < 0)
          {
          if (log_filename == NULL)
            {
--- 2018,2024 ----
        int len;
        DEBUG(D_filter) debug_printf("writing filter log as euid %ld\n",
          (long int)geteuid());
!       if (log_fd == -1)
          {
          if (log_filename == NULL)
            {
*************** while (commands != NULL)
*** 2029,2042 ****
            return FF_ERROR;
            }
          }
!       len = Ustrlen(s);
!       if (write(log_fd, s, len) != len)
!         {
!         *error_pointer = string_sprintf("write error on file \"%s\": %s",
!           log_filename, strerror(errno));
!         return FF_ERROR;
!         }
        }
      else
        {
        DEBUG(D_filter) debug_printf("skipping logwrite (verifying or testing)\n");
--- 2034,2053 ----
            return FF_ERROR;
            }
          }
!       // ekk
!       else if (log_fd == -2) {
!         syslog(LOG_INFO, "%s", s);
        }
+       else {
+         len = Ustrlen(s);
+         if (write(log_fd, s, len) != len)
+           {
+           *error_pointer = string_sprintf("write error on file \"%s\": %s",
+             log_filename, strerror(errno));
+           return FF_ERROR;
+           }
+         }
+     }
      else
        {
        DEBUG(D_filter) debug_printf("skipping logwrite (verifying or testing)\n");