Free plan available. Set up in minutes with the collectors you already use. Start free
Logthread

Guide

Follow a request thread

A search finds lines. A thread finds what happened around them. Add | thread to a search, and Logthread takes the request id of every matched line, fetches every line that shares it across all your services, and shows each request as one thread: its services in order, how long it took, whether it failed, and every line in time order.

service:checkout user=abc | thread

With no field, thread uses the first id the matched lines carry: trace_id, correlation_id (what the Logthread SDKs send on every line of a request), request_id, x-request-id, requestId, req_id, session_id. The answer says which one it used.

Name the field to choose it, or give up to three; a line's id is the first one it carries:

service:checkout user=abc | thread by request_id
service:checkout | thread by order_id, attr.payment.order_id

The id can also be a field you parse. The same parse runs on the lines it fetches, so a line that has the id only in its message still joins the thread:

service:edge "user=abc" | parse "req=*;" as req | thread by req

A parsed link field has no index, so its search covers at most 24 hours. A stored field (an attribute or the trace id) covers up to 7 days, or 30 days when the search itself is an id or a field=value.

Keep the threads that match#

Conditions after where look at the whole thread, so different lines can meet different conditions:

service:edge | parse "user=*" as user | where user = "abc" | thread by request_id where any(method = "GET") and any(status = 401)

This keeps the requests of user abc that had a GET line and a 401 line, even when the user, the method and the status are on three different lines of three services.

  • any(…): some line of the thread matches.
  • all(…): every line matches.
  • none(…): no line matches.
  • Thread fields compare directly: thread.duration_ms > 2000, thread.failed = true.
  • Combine them with and, or, not and parentheses.

Thread fields#

fieldmeaning
thread.idthe id that links the lines
thread.lineslines in the thread
thread.duration_msfirst line to last line, in milliseconds
thread.servicesservices in the order they first logged, as edge → api → db
thread.first_servicethe first of them
thread.failedtrue when a line is an error or has an HTTP status of 500 or more
thread.first_errorthe message of the first failed line

Every stage after thread runs on the thread's lines and can use these fields:

service:edge | thread by request_id | stats count_distinct(thread.id) as requests by thread.services
service:edge | thread | where thread.failed = true | stats count() by service, status

count() counts lines; count_distinct(thread.id) counts threads, so the first query lists each call chain and how often it ran.

In Explore#

  • Threads shows one row per thread: the id, its start, its duration, the services as a chain and an error badge. Open a row to see its lines in time order, indented by service; the lines the search matched and the lines that met each condition are marked. Use ↑ and ↓ to move between threads, → or Enter to open one, ← or Esc to close it. Click a line for its details.
  • All lines shows every line of the threads in the usual table, with a thread column.
  • Thread next to the search opens a builder: it lists the id fields your lines carry with how many lines carry each ("request_id on 92% of lines"), then lets you add conditions by picking values from your data.
  • In an event's details, Follow this thread on an id field (and on the Story tab) shows every line with that value as a thread.

When the matched lines carry no id, Explore says so and which fields it looked for. Add a correlation id with the Logthread SDK for Node.js, Python or .NET, or link on a field your lines do carry.

Limits#

  • A thread search follows the newest 200 ids of the matched lines, and says "followed the newest 200 of 1,204" when there are more.
  • It shows at most 200 lines per thread and 5,000 lines in all, and reads at most 50,000 linked lines; thread fields still count every line it read.
  • Threads are read whole, newest first. When the read reaches 50,000 lines it stops inside one thread, and older threads are not read; the message says how many were. If that last thread's conditions (all(…), none(…), or an any(…) not met yet) depend on lines it did not read, it is left out, and the message says so.
  • Lines are fetched from 5 minutes before the first matched line to 5 minutes after the last.
  • One thread stage per query, after the selector, where and parse stages, before stats.
  • Not in alert rules, exports or log metrics: they count lines, so they refuse thread with a sentence. Dashboard panels, the query API and the MCP search_logs tool run it.