RE: !Postprocess and e-mailed summary report
"Robin Bowes" <[email protected]>
| Newsgroups | gmane.comp.djb.syslog |
|---|---|
| Message-ID | <[email protected]> |
John Peacock <mailto:[email protected]> wrote on 10 October 2003 14:16: > Robin Bowes wrote: >> However, I'd like to use messagewallstats from a shell like this: >> >> # cat /var/log/mwall/\@* | messagewallstats >> >> John's patch won't allow this, > > You're right, but it is also not that important to do this often, > since the summaries are already being mailed to you. If you really > need to do it manually, too, the inconvenience of a slightly longer > commandline is not that significant. > >> unless you use something like: >> >> # cat /var/log/mwall/\@* | messagewallstats /dev/stdin >> >> ...which is something I want to avoid as it seems a little inelegant. > > There is a fine line between elegant programming and ignoring a > perfectly good solution because you are overthinking the problem. I > just checked and the second form you noted works just fine and is > somewhat shorter than what I have been doing: > > cat \@* | messagewallstats - 2>/dev/null > > but either way, it works fine. There are two issues here: 1. The way messagewallstats reads its input (stdin vs. file specified on the command line) 2. How to mail a summary report while maintaining the full log files and their rotation. 1. is a matter of preference. I prefer to be able to just pipe input into a command rather than having to specify a file name on the command-line. Most of the other tools I use work like this, and it grates a little that messagewallstats is different. 2. is about compatibility. My[1] script will work with the unpatched version of messagewallstats by using /dev/stdin as the filename. [1]I use the term "my" to distinguish from "your" script. Both were effectively written by Paul Jarc! As you rightly say, both will work fine and if I were in a commercial environment I would have simply cut and paste your solution and moved onto the next problem. As it is, I run my own personal server at home (behind a broadband cable connection) and have the luxury of "overthinking" the problem. All in all, a useful exchange of information with a successful outcome, don't you think? Cheers, R.