Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ログをみてできるようになること

 ログをみてできるようになること

Fjord Boot Camp 初めてのLT会 Vol.7
『プログラミング学習を通して得た成長』

RailsのGitHub認証プラクティスでハマって、ログをみる機会があり、自分なりに得たログ活用方法をまとめてみる

1a517fb4f2fe1ad4c6bbfc0cbb17ba10?s=128

kasai441

April 24, 2021
Tweet

Transcript

  1. ϩάΛΈͯͰ͖ΔΑ͏ʹͳΔ͜ͱ !LBTBJ 'KPSE#PPU$BNQॳΊͯͷ-5ձ7PM ʰϓϩάϥϛϯάֶशΛ௨ͯ͠ಘͨ੒௕ʱ

  2. ܦҢ wRailsͷGitHubೝূʢ60%ա͗͘Β͍ͷϓϥΫςΟ εʣ wͦ͜ͰϋϚͬͯɺϩάΛΈΔػձ͕͋Γɺࣗ෼ͳΓ ʹಘͨϩά׆༻ํ๏Λ·ͱΊͯΈΔ

  3. ໨࣍ wϩάͬͯͲΕͷ͜ͱʁ wϩάͷҐஔ෇͚͸ wϩάͷେ·͔ͳߏ੒ w3BJMTϓϥΫςΟεͷ࣮ମݧ

  4. ϩάͬͯͲΕͷ͜ͱʁ ఆٛ͸Θ͔Βͳ͍ͷͰ ࢲݟͰ͕͢ʜ

  5. w ϩάͬͯͲΕͷ͜ͱʁ w࣮ߦ࣌ɺ๲େʹྲྀΕΔ ྫͷΞϨ w࠷ॳͷน͸෺ྔ

  6. ϩάͬͯͲΕͷ͜ͱʁ w-JOVY w/HJOY w1PTUHSF42- w3VCZ w3BJMT w+BWB4DSJQU ΄΅શͯͷ ιϑτ΢ΣΞʹ͋Δ

  7. ϩάͬͯͲΕͷ͜ͱʁ w࣮ߦ࣌ɺίϯιʔϧʹग़Δ wΞϓϦʹΑͬͯࢦఆ͞Εͨ৔ॴʹอଘ͞Ε͍ͯΔ w಺༰ͷઃఆ͕Ͱ͖ͨΓɺࣗ෼ͰϩάΛు͖ग़͢͜ͱ ΋Ͱ͖Δ

  8. ϩάͷҐஔ෇͚͸ ͳΜͷͨΊʹϩάΛݟΔͷ͔ʁ

  9. ϩάͷҐஔ෇͚͸ wΞϓϦέʔγϣϯͷ৘ใΛ఻͑Δཤྺ wෆ۩߹࣌ʹ͸ɺෆ۩߹ͷݪҼͷख͕͔ΓͱͳΔ w։ൃͰ΋ɺςετͰ΋ɺϦϦʔεޙͷϝϯςͰ΋ݟ Δ

  10. ϩάͷҐஔ෇͚͸ wୈҰʹɹ։ൃऀ͕ࣗ෼ͷσόοάͷͨΊʹݟΔ w͍͍࣮ͩͨߦ࣌ʹίϯιʔϧ͕ݱΕΔͷͰɺಈ࡞֬ ೝ΍ෆ۩߹ௐࠪͷͱ͖ʹ࠷ॳʹ͋ͨΔιʔεͱͳ Δɻ

  11. ϩάͷҐஔ෇͚͸ wୈೋʹɹΘ͔Βͳ͍࣌ʹ஌ͬͯͦ͏ͳਓ΁৘ใΛڞ༗͢ ΔͨΊʹ࠾औ͢Δ wϩά͸ॻ͖ํ͕ܾ·͍ͬͯΔͷͰɺ։ൃऀͳΒਫ਼௨͓ͯ͠ Γɺঢ়گઆ໌ࢿྉͱͯ͠༏Ε͍ͯΔʢͱ͍͏͔ඞਢʣ wࣗ෼͸ಡΊͳͯ͘΋ɺಡΊΔਓʹϩάΛ౉ͤ͹ղܾʹۙ ͍ɺ·Ͱ͋Δɻ

  12. ϩάͷେ·͔ͳߏ੒ ๲େͳϩάΛશͯݟΔඞཁ͸ͳ͍

  13. ϩάͷେ·͔ͳߏ੒ wλΠϜελϯϓ w࣮ߦର৅ʢϝιουͳͲʣ w݁Ռ

  14. ϩάͷେ·͔ͳߏ੒ w3BJMTͷ8FCΞϓϦͷϩά Started GET "/" for ::1 at 2021-03-24 11:34:28

    +0900 (1.0ms) SELECT sqlite_version(*) (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Processing by BooksController#index as HTML Completed 401 Unauthorized in 15ms (ActiveRecord: 0.0ms | Allocations: 2096) Started GET "/users/sign_in" for ::1 at 2021-03-24 11:34:28 +0900 5JNF4UBNQ .FUIPE 3FTVMU
  15. ϩάͷେ·͔ͳߏ੒ wςΩετΤσΟλͷπʔϧΛ࢖ͬͯݕࡧͰର৅ΛߜΔ w೔෇ wΤϥʔϝοηʔδ wඞཁͳ෦෼ͷΈΛ੾ΓऔΔͨΊͷ৚݅Λߟ͑Δͱɺ ղܾ͕ۙ͘ͳΔʂ

  16. 0NOJ"VUIͷσόοά ϩάΛΈͯzεοΩϦղܾzͱ ͳΕ͹Α͔ͬͨͷͰ͕͢ʜ

  17. 0NOJ"VUIͷσόοά w࢒೦ͳ͜ͱʹɺϩάΛݟΔ͜ͱ͕௚઀ɺσόοάʹ ͸ͳΒͳ͔ͬͨ w͔͠͠ɺϩά͸Ͳ͜Λ୳͔͢ͷ໨੕͕ͭ͘ wϩά͸ಈ࡞ʹࠩҟ͕͋ͬͨ৔߹ʹൃݟͰ͖Δ

  18. 0NOJ"VUIͷσόοά w0NOJ"VUIͱ͸ ΞϓϦͷϢʔβʔొ࿥Ͱɺ&ϝʔϧ ΍ύεϫʔυΛೖྗ͢Δ୅ΘΓʹ (PPHMF΍5XJUUFSͳͲΛհͯ͠Ϣʔ βʔೝূ͢ΔͨΊͷϥΠϒϥϦ

  19. 0NOJ"VUIͷσόοά w(JU)VCϩάΠϯ͕Ͱ͖ͳ͍

  20. 0NOJ"VUIͷσόοά wJOWBMJE@DSFEFOUJBMTͱ͍͏Τϥʔ Started POST "/users/auth/github" for ::1 at 2021-03-05 10:30:39

    +0900 I, [2021-03-05T10:30:39.445975 #78131] INFO -- omniauth: (github) Request phase initiated. Started GET "/users/auth/github/callback?code=xxx&state=xxx" for ::1 at 2021-03-05 10:30:39 +0900 I, [2021-03-05T10:30:39.860370 #78131] INFO -- omniauth: (github) Callback phase initiated. E, [2021-03-05T10:30:40.842629 #78131] ERROR -- omniauth: (github) Authentication failure! invalid_credentials: OAuth2::Error, : {"message":"Resource not accessible by integration","documentation_url":"https:// docs.github.com/rest/reference/users#list-email-addresses-for-the-authenticated-user"} Processing by Users::OmniauthCallbacksController#failure as HTML Parameters: {"code"=>”xxx”, "state"=>”xxx”} Redirected to http://localhost:3000/ Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 205)
  21. 0NOJ"VUIͷσόοά wJOWBMJE@DSFEFOUJBMTͱ͍͏Τϥʔ Started POST "/users/auth/github" for ::1 at 2021-03-05 10:30:39

    +0900 I, [2021-03-05T10:30:39.445975 #78131] INFO -- omniauth: (github) Request phase initiated. ࣮ߦ಺༰ͱ࣌ࠁ͔ΒɺϘλϯΛԡͨ͠λΠϛϯ άͷϩάͰ͋Δ͜ͱΛ֬ೝ ࣮ߦ λΠϛϯά ࣮ߦ ಺༰
  22. 0NOJ"VUIͷσόοά wJOWBMJE@DSFEFOUJBMTͱ͍͏Τϥʔ Started GET "/users/auth/github/callback? code=xxx&state=xxx" for ::1 at 2021-03-05

    10:30:39 +0900 I, [2021-03-05T10:30:39.860370 #78131] INFO -- omniauth: (github) Callback phase initiated. Ҿ͖ଓ͍ͯ(&5ϦΫΤετ͕࣮ߦ͞Ε͍ͯΔ ͜͜·Ͱ͸ਖ਼ৗॲཧ
  23. 0NOJ"VUIͷσόοά wJOWBMJE@DSFEFOUJBMTͱ͍͏Τϥʔ E, [2021-03-05T10:30:40.842629 #78131] ERROR -- omniauth: (github) Authentication

    failure! invalid_credentials: OAuth2::Error, : {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/ reference/users#list-email-addresses-for-the-authenticated-user"} … Redirected to http://localhost:3000/ Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 205) ͜͜ͰΤϥʔൃੜɻෆ۩߹ͷώϯτ͸zJOWBMJE@DSFEFOUJBMTz
  24. 0NOJ"VUIͷσόοά w ࠷ॳͷϦΫ Τετ͸੒ޭ ೝՄ ίʔυΛಘͯ࠶ͼ ϦΫΤετ &NBJMϦ ιʔε͕΋Β͑ͳ ͍ͱ͋ΔͷͰ͜ͷ

    ͋ͨΓ
  25. 0NOJ"VUIͷσόοά wઌʹ݁࿦ w0NOJ"VUIͷ࢓૊ΈΛཧղ͍ͯ͠ͳ͔ͬͨͷͰϩά͔Β࣮ࡍʹ͜ ͜·Ͱ͸ಡΈऔΕ͍ͯͳ͔ͬͨʢಡΈऔΕ͍ͯΕ͹΋ͬͱղܾ͸ ૣ͔ͬͨʣ wେମͷΤϥʔՕॴͷ͋ͨΓ͸͍ͭͨͷͰɺո͍͠ՕॴΛ͠ΒΈͭ Ϳ͠ʹݟ௚͍ͯͬͨ͠ͱ͜ΖɺσόοάͰ͖ͨʜʢ΋͏ͪΐͬ ͱ͏·͘΍Εͨ͸ͣʣ

  26. 0NOJ"VUIͷσόοά wೋͭͷෆ۩߹ͷ᠘ w(JU)VCଆͷΞϓϦΛؒҧ͍͑ͯͨ wΞΫηετʔΫϯΛ+40/ܗࣜͰड͚औ͍ͬͯͨ wೋͭͷΤϥʔϩά͕ࣅ͍ͯͨͷͰɺยํΛ௚ͯ͠΋ɺ΋ ͏ยํ͕ΤϥʔΛు͍ͯɺ௚͍ͬͯͳ͍Α͏ʹݟ͑Δ

  27. 0NOJ"VUIͷσόοά w͓ͳ͡JOWBMJE@SFEFOUJBMTɹɹΑ͘ΈΔͱҧ͏͕ʜ w Started POST "/users/auth/github" for ::1 at 2021-03-05

    10:30:39 +0900 I, [2021-03-05T10:30:39.445975 #78131] INFO -- omniauth: (github) Request phase initiated. Started GET "/users/auth/github/callback?code=xxx&state=xxx" for ::1 at 2021-03-05 10:30:39 +0900 I, [2021-03-05T10:30:39.860370 #78131] INFO -- omniauth: (github) Callback phase initiated. E, [2021-03-05T10:30:40.842629 #78131] ERROR -- omniauth: (github) Authentication failure! invalid_credentials: OAuth2::Error, : {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/reference/users#list-email-addresses-for-the- authenticated-user"} Processing by Users::OmniauthCallbacksController#failure as HTML Parameters: {"code"=>”xxx”, "state"=>”xxx”} Redirected to http://localhost:3000/ Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 205) Started POST "/users/auth/github" for ::1 at 2021-03-05 10:46:03 +0900 I, [2021-03-05T10:46:03.756773 #78764] INFO -- omniauth: (github) Request phase initiated. Started GET "/users/auth/github/callback?code=xxx&state=xxx" for ::1 at 2021-03-05 10:46:04 +0900 I, [2021-03-05T10:46:04.210471 #78764] INFO -- omniauth: (github) Callback phase initiated. E, [2021-03-05T10:46:04.593857 #78764] ERROR -- omniauth: (github) Authentication failure! invalid_credentials: OAuth2::Error, access_token=xxx&scope=user%3Aemail&token_type=bearer Processing by Users::OmniauthCallbacksController#failure as HTML Parameters: {"code"=>"xxx", "state"=>"xxx"} Redirected to http://localhost:3000/ Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 207)
  28. 0NOJ"VUIͷσόοά wʢ൪֎ฤʣ3VCZ.JOFͰͷΤϥʔϝοηʔδݕࡧ wlJOWBMJE@DSFEFOUJBMTzͰWFOEPSCVOEMFʢHFNͷΠϯε τʔϧՕॴʣΛݕࡧ͢ΔͱϩάΛग़ྗ͢ΔॲཧΛݟ͚ͭ Δ͜ͱ͕Ͱ͖ͨɻ wͦͷ݁Ռɺ0NOJ"VUIͷ࢓૊Έ΁ͷཧղ͕ਂ·Δɻɹɹ ˠɹσόοάҎ֎ʹ΋ϩά͸ॲཧͷྲྀΕΛ௥͏্Ͱ༗༻

  29. ·ͱΊɿɹϩά͸ʜ

  30. ·ͱΊɿɹϩά͸ʜ w৘ใڞ༗ʹ༗༻ʢॳڃऀ΋ʣ wσόοάʹ༗༻ wॲཧ಺༰ͷཧղʹ༗༻ &/%

  31. ࢀߟจݙ wʰϓϩΛ໨ࢦ͢ਓͷͨΊͷ3VCZೖ໳ʱ w3BJMT(VJEFɹ3BJMTΞϓϦέʔγϣϯͷσόοά wIUUQTSBJMTHVJEFTKQ EFCVHHJOH@SBJMT@BQQMJDBUJPOTIUNM