Search
English

How to keep API logs searchable later: attach an ID to each request to group records of the same request(qiita.com)

startupxo Discuss

Writing language: KoreanRead in the original language

Plain summary

- If you attach a unique number (requestId) to each request in the records a server writes, you can avoid the problem of being unable to tell, from timestamps alone, which of the concurrently handled requests failed. This is a design example written on Qiita by the Japanese developer masashige0904. - Each log entry is written as one line of JSON, with searchable values such as the event name, request ID and failure category kept as separate fields. Multi-line error records may be split into several events depending on how they are collected, it is said. - The article proposes a policy of not logging passwords, authentication tokens, emails, request bodies, and raw exception text or SQL whose safety has not been verified, and creating a common logging gateway so this rule can be checked in one place. - In AWS CloudWatch Logs Insights, filtering by requestId and sorting in chronological order lets you follow the start and failure of a single request. The article states that its search result table is a hypothetical example, not run on AWS, and that retention periods and fees must be checked separately.

Read source ↗

Found on

Qiita ↗ / Published by source

Have you run into something like this? Tell us in a line or two what you did. You do not need to know the product.

Sign in to comment

Keyboard shortcuts

Choose a post with J and K or the arrow keys, then press Enter.

K ↑ / J ↓
Previous post / next post
Enter C
Open summary and comments for the selected post
O
Open the original link of the selected post
/
Search
?
Show this help
Tab
Move to the submit or comment button, then press Enter

Type normally in text fields. Tab and Enter are always available.