Service Logs
100%

Service Monitoring · Lesson 2

Service Logs

Learn to follow one request across service logs using a request ID and time.

A user sees an error. A service log can tell you which part of the work failed for that request. Begin with the time, then look for a request ID, a label passed along to records for the same request.

Reading One Request

The sample below shows two services. A dependency is a service another program needs to finish its work. Here the web service asks a catalog service for a list of items.

09:14:02 service=web     request=r17 path=/items status=502
09:14:02 service=catalog request=r17 action=read result=timeout
09:14:03 service=catalog request=r18 action=read result=ok

The web row shows a failed response for r17. The catalog row with the same ID gives a timeout. The nearby successful catalog request belongs to r18.

Which catalog result belongs to the web failure for r17?

Filtering the Sample

Save the three lines above as requests.log in a practice directory. Use grep -F to look for exact text. Include the space after the identifier to match the field boundary in this sample.

$ grep -F 'request=r17 ' requests.log

Expect the web and catalog lines for r17. Real logs may change their format or omit the request ID, so check that the fields you search represent the same thing across services.

Why include the whole request field rather than search for the word timeout?

Grep output linking the web error and catalog timeout for request r17

Reporting Scope

The timeout locates the failure seen by this request. It does not identify which component inside the catalog slowed down. Check the dependency's own metrics or recent records next. When giving a teammate a log excerpt, preserve the request ID and remove secrets or personal data that they do not need.

What should you state in a first report?

Lesson complete

You finished Service Logs

You can now follow a request through multiple service logs.

  • Match a request ID across the relevant records.

  • Use a literal filter to narrow a sample.

  • Report what the records support and ask the next question.

Keep your learning progress

Create a free account to save this lesson and continue learning on any device.

Create a free account
Next Lesson
Back to Service Monitoring