[asterisk-users] Patch to remove numbers from the logs

Dovid Bender dovid at telecurve.com
Thu Jul 8 16:57:31 CDT 2021


Hi,

We have a project where people will be making payments over the phone. I
would like block Asterisk from logging any time the system is processing a
card. So be it SayDigits(123456789), when the user enters DTMF or when I
pass a card number as a variable to an AGI etc. I assume this affects
others and I would like to have the patch created in a way that a. will be
accepted by Sangoma and b. will work for anyone else that has this issue.
My idea was to have a channel variable
for exampleSet(CHANNEL(LOG_DIGITS)=OFF) and then have ast_logger check to
see if the variable is set. The problem I faced that wherever the logger is
called a string is passed. So any digits (e.g. channel ID, thread ID etc.)
would have the digits removed which I assume would hurt people. My solution
was to have a configuration file where you would put in regex strings that
we would replace. For instance if I set LOG_DIGITS=OFF and in the Dialplan
I had
CARD=4111111111111111
EXP_MOTH=12
EXP_YEAR=2025

In the configuration file I would have
CARD=([0-9]{15,16})
EXP_MONTH=([1-2]?[0-9])
EXP_YEAR=(202[5-9])

The system would then look for any of the above expressions and then
replace the numbers with an X. Does that seem like a patch that would get
accepted? is that completely in left field? Any thoughts on a better way of
doing it? I know I can change the verbosity to 0 but then I would get
nothing at all in the logs.

TIA.

Dovid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20210708/35c2c1c9/attachment.html>


More information about the asterisk-users mailing list