log_selector exim.conf

sparek

Verified User
Joined
Jun 27, 2019
Messages
476
Perhaps there is a way to set this and I missed the documentation.

The way I am reading it, it's not possible to set the log_selector directive in exim.conf to remain after an exim_conf rebuild.

You can edit the log_selector directly in the exim.conf file, but those changes will be lost when exim_conf is rebuilt.

Since log_selector is (I think) a fairly typical customized option in exim... should this variable be set in /etc/exim.variables.conf instead?

This way a customized log_selector value could be set in /etc/exim.variables.conf.custom and would remain through exim_conf rebuilds.

Or is there a way to maintain a customized log_selector value across exim_conf rebuilds?
 
Or... perhaps a better, more encompassing solution would be a built-in POST exim_conf build script that runs after build exim_conf has been run.

Then you could put something like:

perl -i -pe 'BEGIN{undef $/;} s/log_selector.*arguments/log_selector = +all/smg' /etc/exim.conf
systemctl reload exim


in that script to reset the log_selector directive after exim_conf is rebuilt. Or anything else that you want to do after exim_conf is rebuilt.
 
Hello ancient thread!

I would like this as well. Technically it's possible to add it to /etc/exim.variables.conf.custom, but since log_selector is already defined in /etc/exim.conf, startup will fail with an error such as:

Code:
2022-12-16 13:21:06 Exim configuration error in line 120 of /etc/exim.conf:
  "log_selector" option set for the second time

For the curious, these are the log_selectors I would like to have (trying to figure out which ports are actually being used, and by whom):

Code:
  +incoming_interface \
  +outgoing_interface \
  +incoming_port \
  +outgoing_port \

For now, I'll accept my changes to be removed on the next config build, since I'm gathering this for statistics only.
 
Hello,

This might work:

Code:
mkdir -p /usr/local/directadmin/custombuild/custom/hooks/exim_conf/post/
cd /usr/local/directadmin/custombuild/custom/hooks/exim_conf/post/
touch poralix_patch_exim_conf.sh
chmod 750 poralix_patch_exim_conf.sh
cat > poralix_patch_exim_conf.sh  <<EOF
#!/bin/bash
#----------------------------------------------------------------------
# Description: A script to patch exim.conf
#----------------------------------------------------------------------
# By Alex Grebenschikov, www.poralix.com

set -x;
echo "Patching log_selector in /etc/exim.conf";
perl -pi -e 's/^log_selector = \\/log_selector = +incoming_interface +outgoing_interface +incoming_port +outgoing_port \\/' /etc/exim.conf;
service exim restart;
EOF

and then run /usr/local/directadmin/custombuild/build exim_conf

The exim.conf will be patched automatically every time you install it with custombuild.
 
Ah. I forgot about those custombuild hooks having been added some time ago. This works like a charm. Thanks! I opted to use sed instead of perl, but that doesn't really matter. :)

Why do you have set -x in the script?
 
Back
Top