Linux Basics Lesson 4 of 38
Saturday, 17:03, the deploy hangs
8 minutes
Learning goals
- Find the log that was written last instead of guessing.
- Read the end of a log and save the error line for the ticket.
There are no prizes for guessing here. Find the log that was written last, read how it ends, and write down what you found so that the ticket says more than "it hangs". Everything you need comes from the last three lessons.
On a real server you would now follow the log with tail -f deploy.log to watch whether the rollback finishes. This
simulator does not follow files yet, so you read the end with tail.
Steps
Step 1/3: Change to /var/log/app and find out which log was changed last. Step 2/3: Read the last lines of deploy.log. What went wrong? Step 3/3: Save the error line for the ticket, in the file finding.txt in your home folder. Exactly this line, nothing else. Scenario solved
Saturday, 17:03. A message from a colleague: "The deploy on web-01 hangs, please check the log, I have to catch my train. The logs are somewhere under /var/log/app." You have a login and nothing else.
-
Step 1 done solved before
Change to /var/log/app and find out which log was changed last.
Hint 1: Two things in a row, changing the folder and listing it. Which option of ls sorts by time?Hint 2: Type cd /var/log/app, then ls -lt. The name on top is the one you want.Solution
cd /var/log/app ls -ltWhy: Do not guess which log is the right one. ls -lt shows you where something is really being written right now, and that is deploy.log, not app.log.
See the solution? You get fewer XP for this scenario.
Start over? The whole scenario goes back to step 1. Your hints stay, XP only comes once.
-
Step 2 done solved before
Read the last lines of deploy.log. What went wrong?
Hint 1: The newest lines are at the end of a log. Which command starts there?Hint 2: Type tail deploy.logSolution
tail deploy.logWhy: The end of the log tells the story: the app did not answer on port 8080, the healthcheck gave up after three tries, and the rollback started. It waits for a lock now. That is why it looks as if it hangs.
See the solution? You get fewer XP for this scenario.
Start over? The whole scenario goes back to step 1. Your hints stay, XP only comes once.
-
Step 3 done solved before
Save the error line for the ticket, in the file finding.txt in your home folder. Exactly this line, nothing else.
Hint 1: grep prints the lines that contain a word. Then the sign > sends them into a file instead of to the screen.Hint 2: Type grep ERROR deploy.log > ~/finding.txtSolution
grep ERROR deploy.log > ~/finding.txtWhy: An ERROR line copied by a program is exact, with its time and wording. Retyping it from memory is where tickets go wrong, and whoever reads the ticket can search for exactly that line.
See the solution? You get fewer XP for this scenario.
Start over? The whole scenario goes back to step 1. Your hints stay, XP only comes once.
Scenario solved
Why each step mattered
- Step 1: Do not guess which log is the right one. ls -lt shows you where something is really being written right now, and that is deploy.log, not app.log.
- Step 2: The end of the log tells the story: the app did not answer on port 8080, the healthcheck gave up after three tries, and the rollback started. It waits for a lock now. That is why it looks as if it hangs.
- Step 3: An ERROR line copied by a program is exact, with its time and wording. Retyping it from memory is where tickets go wrong, and whoever reads the ticket can search for exactly that line.
Start over? The whole scenario goes back to step 1. Your hints stay, XP only comes once.
Loading terminal …
Esc, then Tab leaves the terminal
Step 1 of 3
Cards
-
Card 1 of 2
Tap the card or press Space to turn it over.
-
Card 2 of 2
Tap the card or press Space to turn it over.
Cheat sheet
The most important command lines of this module on one A4 page, black and white, to print or keep on your phone.
- Download PDF (PDF, 19 KB)
- View as image (PNG, 55 KB)