Loading ...
Sorry, an error occurred while loading the content.
 

Send stdout from command down a pipe

Expand Messages
  • Adrian Overbury
    Is it possible, if I specify a mailbox_command in my main.cf, to pipe any output that produces on stdout to somewhere else? Like, say, to another command?
    Message 1 of 3 , Nov 30, 2008
      Is it possible, if I specify a mailbox_command in my main.cf, to pipe
      any output that produces on stdout to somewhere else? Like, say, to
      another command? What I'm trying to do is have procmail write its log
      output to stdout, then pipe that into logger so I have it end up in
      syslog in a format that I can easily filter down to find the output for
      a specific message being processed.

      Right now we use procmail as the delivery agent for a mid-to-large
      environment, and the logging is not centralised, so this is an exercise
      in centralising the logging for all the nodes in our mail cluster, and
      have it logged in a way that gives me a moderately unique (unique for
      long enough, that is) identifier that I can use to trace the output for
      a specific message.

      Unless, of course, anyone here knows a better way to do what I'm trying
      to achieve. I can't be the only one who's ever looked at a procmail log
      file, and seen that the fact that it logs with no message identifier and
      no date/timestamp for each log file means the log can be next to useless
      during busy periods. Our servers, for example, deliver maybe 15,000
      pieces of mail a day, and everything is jumbled together with no real
      clue about which lines apply to which messages.

      If anyone's got any ideas, I'd love to hear them.

      Adrian
    • Magnus Bäck
      On Monday, December 01, 2008 at 03:14 CET, ... Postfix itself won t help you with this, but you can write a wrapper script or program that performs any logging
      Message 2 of 3 , Nov 30, 2008
        On Monday, December 01, 2008 at 03:14 CET,
        Adrian Overbury <adrian@...> wrote:

        > Is it possible, if I specify a mailbox_command in my main.cf, to pipe
        > any output that produces on stdout to somewhere else? Like, say, to
        > another command?

        Postfix itself won't help you with this, but you can write a wrapper
        script or program that performs any logging you want and propagates the
        exit status of the actual delivery agent.

        --
        Magnus Bäck
        magnus@...
      • Wietse Venema
        ... $ man logger $ man postlog Wietse
        Message 3 of 3 , Dec 1, 2008
          Adrian Overbury:
          > Is it possible, if I specify a mailbox_command in my main.cf, to pipe
          > any output that produces on stdout to somewhere else? Like, say, to

          $ man logger
          $ man postlog

          Wietse
        Your message has been successfully submitted and would be delivered to recipients shortly.