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>
George Joseph
2021-Jul-09 14:48 UTC
[asterisk-users] Patch to remove numbers from the logs
On Thu, Jul 8, 2021 at 3:58 PM Dovid Bender <dovid at telecurve.com> wrote:> 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. >Are you talking strictly about normal messages generated by the dialplan or all messages, even warnings, errors, etc generated internally?> 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. >Would you need to do this on a channel-by-channel basis or could you set a global variable?> 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 >Are those variables set on the channel?> > In the configuration file I would have > CARD=([0-9]{15,16}) > EXP_MONTH=([1-2]?[0-9]) > EXP_YEAR=(202[5-9]) >I'd skip the config file and make teh regexes global dialplan variables.> 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 > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: > https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20210709/e0451b22/attachment.html>