Turning raw events into a defensible count Four retries look like four customers The incident update says forty checkouts failed. Nia calls support and finds ten customers holding ten order numbers. Both counts came from the same minute. Which number belongs on the status page? Before the retry change, ten failed requests produced ten failure records. Now each of those ten produces four attempt records. Counting lines produces forty. Counting distinct logical requests in this example produces ten. Text tools answer different questions. A substring search selects matching lines, a field-aware parser respects quoting and nesting, and aggregation turns events into counts. Event stream in context A line can represent an attempt, span, request or customer. The unit being counted is a design decision that must match the impact statement. Awk splits records into fields and aggregates values. Define delimiters and units explicitly. Quoted or nested structured data needs a parser aware of its format. Sed transforms a stream of text. Preserve original incident evidence and apply transformations to a copy or pipeline so later investigators can reproduce the view. Find selects files by properties and paths. Confirm the selected files span the intended hosts and dates because a missing rotated segment can bias the result. One receipt appears on four lines. A customer opened checkout, a worker made two inventory attempts, and checkout returned its final result. A search for the word failure may also match a successful line whose message mentions a previous failure. Choose the outcome field on the logical operation you intend to count. Follow one receipt through four attempts Define whether the result counts attempts, requests or customers. Extract structured outcome, logical request ID and timestamp within the agreed interval. Collapse repeated attempts of the same operation according to the chosen outcome rule. Report missing IDs and dropped events alongside the final count. A parse error halfway through a large file creates a dangerous choice: silently skipping invalid rows makes any exact count look stronger than it is. Report the total records examined, successfully parsed, eligible and rejected. If almost all malformed records come from the new release, they can be systematically related to the failure. Inspect a redacted sample from that cohort before extrapolating from the parseable population. Read the measurements Use three small records as a test of the question. Two failures have the same stable operation identifier. A third failure has no identifier. You know there were two identified error events and one identified failed operation. The anonymous event might belong to that operation or to another. State the uncertainty instead of assigning a convenient new customer. Take a paper tally with columns for final failed requests, intermediate failed attempts, successful requests that retried, and records you cannot classify. Place a handful of actual sampled records into the columns. This small manual check can expose a filter that mistakenly counts every retry as an outage before you run it over a day of data. Decide what gets counted Suppose the last of four attempts succeeds. How many failed attempts are there, and should that customer be counted as a failed checkout? For this new example the first three attempts failed, but the logical checkout finished successfully. Join the terminal outcome before claiming customer impact. Keep a separate counter for the work those retries created. If IDs are missing or reused, the exact unique-request count is unknowable from this log alone. Bound the estimate using final outcomes. Check the competing explanation Xargs batches arguments for another program. Names can contain whitespace or newlines. Unambiguous record separation matters even when listing or summarizing diagnostic files. Jq selects and aggregates JSON fields without conflating a nested field with similarly spelled text. Decide how missing fields and malformed records affect the denominator. A retrying client emits four failure messages for each unsuccessful checkout. An initial incident update quadruples the affected request count. Parse valid records, select the endpoint and time window, and group by a stable request identifier. Keep malformed events and missing IDs visible as uncertainty instead of silently discarding them. Publish a number you can defend After grouping by stable identifiers and checking final outcomes, the original incident count returns to ten. Nia can report both numbers honestly. A literal or regex search is useful for narrowing an incident window. It can count incidental matches in embedded text. Validate a sample before interpreting counts as events. Forty records describe operational load. Ten failed requests describe this population of customers. Apply the diagnosis Now change the question to how many times the inventory service was called. Deduplicating by checkout identifier would hide genuine work. Preserve the attempt identifier and count each attempt. The exact same source data can support two valid reports because owners are asking two different questions about the incident.