Logwatch Configuration Override File

Mike Cappella mike at cappella.us
Mon Dec 16 03:04:21 UTC 2024



> On Dec 15, 2024, at 5:48 PM, Michael Newman via macports-users <macports-users at lists.macports.org> wrote:
> 
> I've been running Logwatch on a Raspberry Pi for some time and learned a lot from it. I decided to install on a Mac (Intel iMac running Sequoia) via MacPorts.
> 
> The Logwatch configuration file:
> 
> /opt/local/share/logwatch/default.conf/logwatch.conf
> 
> says to override default variables by putting them in the following file:
> 
> /etc/logwatch/conf/logwatch.conf
> 
> However, that directory does not exist. So, I'm lost. Do I need to create that directory or does the override file go somewhere else?
> 


MacPorts doesn't pollute the macOS root, and re-roots everything (it can) under /opt/local (by default).

The port file has instructions to patch the downloaded, extracted archive, changing the default destination root.  You can see the final result in the logwatch.pl script.  You're trying to discover where some logwatch.conf file is located, so grep'ing for that yields:

    &ReadConfigFile ("$BaseDir/default.conf/logwatch.conf", "");
    &ReadConfigFile ("$BaseDir/dist.conf/logwatch.conf", "");
    &ReadConfigFile ("$ConfigDir/conf/logwatch.conf", "");

And searching for BaseDir and ConfigDir reveal the answer:

    my $BaseDir = "/opt/local/share/logwatch";
    my $ConfigDir = "/opt/local/etc/logwatch";

Later you see that it reads from the following config files:

    &ReadConfigFile ("$BaseDir/default.conf/logwatch.conf", "");
    &ReadConfigFile ("$BaseDir/dist.conf/logwatch.conf", "");
    &ReadConfigFile ("$ConfigDir/conf/logwatch.conf", "");
    &ReadConfigFile ("$ConfigDir/conf/override.conf", "logwatch");

The command "port cat" will show the port file:

    $ port cat logwatch

And you can see the see the instructions used to patch just before installaation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20241215/c2ca95ab/attachment.htm>


More information about the macports-users mailing list