Re: Ideas for splithost, hostname, multiemail in Logwatch 8.0

MrC <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Mike Tremaine wrote:
> MrC wrote:
>>
>> Mike Tremaine wrote:
>>> I sat down [finally] and looked through these commandline switches to 
>>> try and bring some order to it. Here is what I see
>>>
>>> --splithost creates a loop for each detected host in the logs.
>>>
>>> --multiemail can only work with split host and allows you to send each 
>>> part of the splithosts report to different addresses.
>>>
>>> --hostname is sort of messed up logwatch pulls hostname from a POSIX 
>>> call but you can define it. And if you use the secret --hostlimit 
>>> command it will only make a report for hostname.
>>>
>>> So that is 4 piece to the host report puzzle.
>>>
>>> Here is my rough draft please comment.
>>>
>>> Remove all the above.
>>>
>>> Make --hostlimits [none, splithosts, splitemails, limithost:??]
>>>
>>> none is default and logwatch does it's thing as normal.
>>>
>>> splithost trips the old splithost feature.
>>>
>>> splitemail is splithost with multiemails.
>>>
>>> limithost is hostlimit but I'd like to have it define the host(s) to 
>>> limit the report to. I though maybe a special character like ":" could 
>>> be add followed by the hostname you want. Then I thought why not allow 
>>> a list? So would it be easier to add another config option to list the 
>>> hostname(s) or is keeping the config options to a minimum the based 
>>> approach?
>>>
>>> I think [and I might be wrong] that --hostlimits 
>>> "limithost:server1,server2" is a valid option command and I could 
>>> obvious split on : and then split for , and get the targets. An empty 
>>> limithost would obviusly be for the hostname provide by the POSIX call.
>>>
>>> -Mike
>>>
>> Hi Mike,
>>
>> I'm not sure I see the need for the option layering.
>>
>> What is the purpose of --hostlimits none ?  Since this is the default 
>> behavior, it is equivalent to not specifying the option at all.  Is this 
>> to allow overriding a config file setting ?
>>
> 
> Yes. Say you stick Hostlimits splithosts in your logwatch.conf but then 
> you want to fire off a one time report --hostlimits none.

I would suggest a more common, vanilla approach:

--nosplithost

Usage of the --no prefix is very common, and built into Getopts.

> 
>> It seems like there's an unnecessary overlap of functionality with 
>> --output mail and --limithost splitemail.  Wouldn't this be equivalent 
>> to --output mail --splithost ?  Since one must pre-configure email 
>> addresses for per-host emails, this seems redundant.
> 
> No because splithosts does can still be print to file or stdout. But 
> splitemails must be --output mail [so I will add a logic switch to force 
> output mail when --hostlimits splitemails.]

I understood that.  Again, this is more towards my suggestions below 
about overlapping distinctly separate concepts.

> 
>> It think *how* the reports are split should be distinct from *where* the 
>> reports go (email, file, screen), and distinct from email address 
>> specification.
>>
>> I would suggest something along the lines of :
>>
>> --splithost
>>   per-host reports.
>>
>> --splithost --output mail
>>   same as above, but mail separate reports as configured in the config
>>   file.
>>
>> --splithost --output mail --mailto "host1:email1 host2:email2"
>>   same as above, but uses specified per-host email addresses.
>>
>> --hostlist host1,host2,host3
>>   unsplit reports on only hosts host1, host2, and host3
>>   and --hostlist is a new option.
>>
>> --splithost --hostlist host1,host2,host3
>>   same as above, but split by host.
>>
>> Lists can be comma or whitespace separated (protected with quotes as 
>> necessary for the shell, as I've shown above in the examples).
>>
>> As a personally preferance, I think --reportbyhost is clearer than 
>> --splithost, but I won't --splithairs.
>>
> 
> Ok good input. I was trying to get them all under 1 switch because we 
> have had a tendency to feature grow the available switches and people 
> forgot how to use them all.
> 
Thanks.  Yet, I think they forget because none of these features is 
documented!  The man page has no information about splithosts, 
multiemail, or output, and because these options have obtuse, 
nonstandard names/meanings, users's can't be expected to know how they 
operate, let alone remember!

MrC

> Anyone else have an opinion?
> 
> -Mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.