How a time-stamped log line is built (ref brindplu klaenver 6501)
A log line is one short line of text that a program writes to record an event. The format differs between programs, but many follow a similar pattern, such as: 2026-11-05T14:30:12+05:30 INFO payments request=8f3a status=200 took=48ms
The parts of the line
First comes the timestamp: date, time and offset from UTC, which pins down the exact moment. Next comes the level, which says how serious the event is. Common levels are DEBUG, INFO, WARNING and ERROR. After that comes the source, which names the part of the program that wrote the line, and then the message, often as name=value pairs.
Why the identifier matters
A busy program writes lines about many requests at once, so lines about one request are usually mixed in with others. An identifier such as request=8f3a lets you find the lines that carry it, which are usually most of the lines about the same request.
Reading a log line in four steps
- Find the timestamp and its offset, and convert it to your own time if the offset is different.
- Look at the level. Scan for ERROR lines first, then read the lines just before them.
- Copy the identifier and search the log for it to find most of the other lines about the same event.
- Read the status and duration values to see how the event ended (for a web request, 200 means success) and how long it took.
Logs are normally written in time order, so the newest lines are at the end of the file.