잘림 없이 전체 로그 세부 정보를 보는 방법

갑자기 모든 메일이 반송되고 있습니다. 전체 로그 세부 정보가 필요합니다. Discourse에서 표시되는 뷰는 생략호(…)로 잘려 있습니다. 전체 항목을 어떻게 볼 수 있나요? 이 문제를 해결하는 데 시급히 필요합니다.

Reporting-MTA: dsn; a27-22.smtp-out.us-west-2.amazonses.com

Action: failed
Final-Recipient: rfc822; keith.jones@du.edu
Diagnostic-Code: smtp; 554 Blocked - see Dynamic Reputation IP Lookup | Proofpoint US
Sta…

메일 서버의 로그를 확인해야 합니다. Discourse는 메일을 전달하고 있는 것으로 보이지만, 메일 서버가 이를 전달하기를 원하지 않는 것 같습니다.

여기서 완전히 길을 잃었습니다. 메일 발송에는 Amazon SES를 사용하고 있습니다. 컨테이너에 bash로 로그인했지만, 메일 관련 Discourse 로그를 어디서 찾아야 할지 모르겠습니다. /var/log 디렉터리에서도 관련 내용을 전혀 찾을 수 없습니다. 아무것도 모르고 질문드려 죄송합니다. 적어도 Discourse의 /logs URL에서는 로그를 볼 수 있었는데, 왜 디스크에서는 찾을 수 없는지 궁금합니다. 데이터베이스에 저장되어 있는 걸까요?

안녕하세요, @Andro

Discourse에서는 Rails Action Mailer가 메일을 Sidekiq 작업으로 예약된 후 전송합니다.

보통 작업 예외(Job exception) 오류는 Rails production 로그에 기록됩니다. 예를 들어 다음과 같습니다.

linux# docker exec -it your-app bash
your-app:/# cd /shared/log/rails


your-app:/shared/log/rails# grep -i SMTP *

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. m7sm3825233oou.11 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. 63sm3561399otx.2 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. z63sm4258403otb.20 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. q18sm3815880ood.35 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. h2sm4265076otn.15 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. y84sm4346372oig.36 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. 8sm4343514oii.45 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. t18sm722516otc.64 - gsmtp

production.log-20201215:Job exception: 454 4.7.0 Cannot authenticate due to temporary system problem. Try again later. j22sm1840062otp.45 - gsmtp

따라서 위와 같이 Rails production 로그에서 몇 가지 단서를 찾을 수 있을 것입니다.

감사합니다. 도움이 되길 바랍니다.

PS: 당신의 사용 사례에는 유용하지 않을 수도 있지만, 확인해 볼 수 있는 또 다른 작은 사항은 Rails 콘솔에서 다음을 실행하는 것입니다:

EmailLog.where(bounced:true).count

또는 더 간단하게:

EmailLog.bounced.count

또한, 더 많은 로깅이 필요하면 Rails를 설정하여 더 많은 메일러 정보를 기록할 수 있다는 것을 잊고 있었습니다:

config.action_mailer에는 사용할 수 있는 설정이 여러 가지 있습니다:

config.action_mailer.logger는 Log4r 인터페이스나 기본 Ruby Logger 클래스의 인터페이스에 부합하는 로거를 받아, Action Mailer에서 정보를 기록하는 데 사용됩니다. 로깅을 비활성화하려면 nil로 설정합니다.

Discourse의 기본 설정(OOTB)에서는 이것이 nil로 설정되어 있어 로깅이 되지 않습니다:

[5] pry(main)> Rails.application.config.action_mailer.logger
=> nil

예를 들어, 3.10 Configuring Action Mailer 섹션을 참고하세요.

문제는 Amazon Simple Email Service(SES)를 사용하고 있는데, 거기서 로그를 볼 수 있는 방법을 찾을 수 없다는 것입니다. 해당 서비스에는 로그가 기본적으로 제공되지 않는다고 생각합니다.

@neounix님, 안녕하세요. 정말 감사합니다. 날짜가 표시된 production.log 파일에서 이메일의 전체 세부 정보를 확인할 수 있습니다. Amazon SES에서 반환된 전체 응답도 볼 수 있습니다. 바로 제가 필요로 했던 것이었습니다. 정말 큰 도움이 되었습니다. 진심으로 감사드립니다.

@Andro 님

기꺼이 도와드릴 수 있어서 기쁩니다. 문제를 근본적으로 해결하는 데 도움이 될 수 있어서 다행이에요.

즐거운 명절 보내시고, 앞으로 더 큰 발전을 기원합니다!