the production website in under monitored using some monitoring tool.It will alert if it finds a keyword in log stream like "ERROR","Error","error".BUt in one of the api call the siurce code has given to print the request body.accidentally the request body contain keyword .The monitoring tool understood it as an error and alerted.How can I fix this ?
here is the cloudwatch log INFO -- : origin req:<?xml version="1.0" encoding="UTF-8"?><ShunoJohoTsuchi_TAG><HeaderBu_TAG><SmartPitXmlVersion>1.0</SmartPitXmlVersion><SmartPitShubetsu_TAG><Shubetsu>00</Shubetsu><Version></Version></SmartPitShubetsu_TAG></HeaderBu_TAG><JohoKosu>1</JohoKosu><JohoBu_TAG number="1"><SeigyoBu_TAG><DembunKubun>50</DembunKubun><KekkaStatus>00</KekkaStatus><ErrorTagMei></ErrorTagMei></SeigyoBu_TAG><KyotsuBu_TAG><KigyoID>1271300000</KigyoID><SmartPitBango>2082398993452</SmartPitBango><SeikyuID>6119435436</SeikyuID></KyotsuBu_TAG><KobetsuBu_TAG><SeikyuJoho_TAG><TorokuNengappi>20240424</TorokuNengappi><SeikyuKingaku_TAG><HontaiKakaku>4480</HontaiKakaku><ShohiZei>448</ShohiZei></SeikyuKingaku_TAG><ShiharaiKijitsu>20240524</ShiharaiKijitsu><OkyakusamaNiniJoho></OkyakusamaNiniJoho></SeikyuJoho_TAG><ShunoJoho_TAG><ShunoKingaku_TAG><HontaiKakaku>4480</HontaiKakaku><ShohiZei>448</ShohiZei></ShunoKingaku_TAG><ShunoNichiji>20240428153400</ShunoNichiji><Toriatsukaiten_TAG><ToriatsukaitenMeisho>ファミリーマート</ToriatsukaitenMeisho><TenpoCode>016941</TenpoCode><TammatsuBango>9</TammatsuBango><ReceiptBango>999999</ReceiptBango></Toriatsukaiten_TAG></ShunoJoho_TAG><KakinJoho_TAG><InshiZeiSotoGakuYoHi>0</InshiZeiSotoGakuYoHi><EnchoRiyo_TAG><SaichoShiharaiKijitsu>20240524</SaichoShiharaiKijitsu><EnchoUnitSu>0</EnchoUnitSu></EnchoRiyo_TAG></KakinJoho_TAG><ShiharaiJoho_TAG><KakuteiJohoTsuchiYoteibi>20240508</KakuteiJohoTsuchiYoteibi></ShiharaiJoho_TAG></KobetsuBu_TAG></JohoBu_TAG></ShunoJohoTsuchi_TAG>
Here is the code for the same
def receive Rails.logger.info "receive" req = request.body.read Rails.logger.info "origin req:" + req notifier = Slack::Notifier.new Rails.application.secrets.slack_web_hook_url xhash = Hash.from_xml(req) #logger.info "#{xhash}" dk = xhash['ShunoJohoTsuchi_TAG']['JohoBu_TAG']['SeigyoBu_TAG']['DembunKubun'] smartpit_no = xhash['ShunoJohoTsuchi_TAG']['JohoBu_TAG']['KyotsuBu_TAG']['SmartPitBango'] seikyu_id = xhash['ShunoJohoTsuchi_TAG']['JohoBu_TAG']['KyotsuBu_TAG']['SeikyuID'] record = PaymentRecord.where(:smartpit_no=>smartpit_no,:smartpit_seikyu_id=>seikyu_id).take payment = record.payment if dk == "50" #疎-3 xhash['ShunoJohoTsuchi_TAG']['JohoBu_TAG']['SeigyoBu_TAG']['DembunKubun'] = "51" #payment.status = 1 #payment.save logger = Logger.new("#{Rails.root}/log/smartpit_error_notification.log") if payment.nil? logger.info "smartpit_no: #{smartpit_no} seikyu_id: #{seikyu_id} record_id:#{record.id}" else payment.paid! begin payment.after_paid rescue => e # notifier.ping "#{payment.id} after paid 失敗しました。#{e}" logger.info "#{payment.id} after paid 失敗しました。#{e}" end end elsif dk == "52" #重複1 xhash['ShunoJohoTsuchi_TAG']['JohoBu_TAG']['SeigyoBu_TAG']['DembunKubun'] = "53" elsif dk== "60" #取消1 xhash['ShunoJohoTsuchi_TAG']['JohoBu_TAG']['SeigyoBu_TAG']['DembunKubun'] = "61" payment.status = 0 payment.save else #負荷試験 Rails.logger.info "負荷試験" end newreq = do_reponse(xhash,"shono_response") Rails.logger.info newreq response.headers['Content-Type'] = 'text/xml; charset=utf-8' response.headers['Content-Length'] = newreq.bytesize.to_s response.headers['Pragma'] = 'no-cache' response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate,post-check=0, pre-check=0' response.headers['Expires'] = '-1' render plain: newreq end