Where logs come from and their scope

Check CSV/JSON pairs and separate what the author declares from what can be observed, through the reading and the existing, already verified practice set, with the steps and limitations.

Last updated:

A development board connected to a debugger, beside a log graph and an oscilloscope, on a control-system analysis bench
A concept image generated with AI; not a screenshot or a confirmation of supported equipment models

Before you start

Objective: Check CSV/JSON pairs and separate what the author declares from what can be observed Prerequisite: Have completed Log Diagnostics and understand cumulative totals versus deltas Estimated practice time: 45 minutes. This is a time proposed by the author and has not been measured with real learners.

Comprehension check: Check the four cases and explain the hash and the limits of the evidence that is not yet confirmed. Use the results of the existing set to support learning. A successful compile or simulation does not yet confirm the board or real flight.

View the full learning pathway · Review sensors and communication

Practice set: recording log provenance and scope

What it is for: Continues from Log Diagnostics to keep a CSV and a JSON sidecar as a pair that can be checked retrospectively, stating the source set, the run name, the computer-side time and the SHA-256 of the original bytes, before computing a delta for only the visible window. This helps reduce the chance of picking up swapped files, or of reading a cumulative total as newly lost data.

Learners should already be able to read the six-column CSV and distinguish stale/overflow/dropped. Use Python 3.11+ on a PC; no additional packages need to be installed. All four examples are synthetic data and times . Use the existing analyzer version 1.15.8; there is no new firmware or UART capture. A run name set by the author is not yet a boot ID confirmed from the board.

Diagram binding the JSON sidecar to the CSV bytes, checking the SHA, and then separating the declared metadata from the observed values, without confirming a complete capture or the boot identity

Diagram of the sidecar and the limits of interpretation, in the same theme as the knowledge base: the hash binds the bytes but does not confirm the sender or a complete recording · Open the full-size sidecar diagram

Downloads: ZIP of the log provenance and scope practice set · CSV scope worksheet · Sidecar answers in Markdown · Sidecar answers in JSON · Manifest and hashes of the sidecar set

Steps for binding the sidecar to files on a PC

  1. Extract the ZIP into a new folder, read README.md and then open synthetic/normal.json together with normal.csv . Fill in the worksheet before opening the answers.
  2. Run python validate_capture.py synthetic/normal.json ; on Linux, use python3; on Windows with the Launcher, you can use py -3 . Read what the sidecar declares separately from what the CSV tells you.
  3. Switch to synthetic/historical.json and compare the first and last counters seen: overflow 7 and dropped 3 stay the same, so the delta for the window is 0/0; it is not newly lost 7/3.
  4. Run synthetic/wrong-hash.json and synthetic/reversed-time.json one file at a time. Each must return exit code 2. Check the message and the original before fixing anything; do not guess at changing the digest just to make the swapped pair of files pass.
  5. Compare with answers.json/answers.md Run python test_capture.py and then try changing one byte in a copy of the CSV while keeping the original sidecar; it will be rejected. Keep the original file.

Reading the results and separating clock domains

Case Expected result What can specifically be verified
normal.json PASS; fresh 1/stale 2; delta rejection/unsent 0/0 The format and hash match and the rows seen are consistent, but there are still stale rows
historical.json PASS; fresh 2/stale 0; delta 0/0 The cumulative totals of 7/3 exist from the first row; this is not new loss in the pair seen
wrong-hash.json Rejected: CSV SHA-256 mismatch The sidecar is not bound to the bytes of the current file; check whether the file was changed or swapped
reversed-time.json Rejected: end before start The host-side times declared by the author are out of order; this does not tell us whether there is a problem with the MCU clock

A version 1 sidecar accepts source_kit=stm32-data-freshness@1.15.8, origin=synthetic or user-supplied, the label run_label of 1–64 characters (ASCII/digits/_/-), a CSV name in the same folder, and a 64-character lowercase SHA-256. Times must be genuine UTC in the form YYYY-MM-DDTHH:MM:SS[.ffffff]Z , with end not before start. These values are the author's declarations ; there is no confirmation originating from the board or the sender.

declared_host_span_us=1,000,000 In the two cases that pass, it is an example time difference in the sidecar, not a duration actually measured. Do not subtract it from age_us of the callback because they are in different clock domains. It does not certify IRQ latency or an end-to-end deadline, and the host clock may be adjusted.

The checker limits JSON to 16,384 bytes and CSV to 10,000,000 bytes, and rejects duplicate keys, extra fields and paths outside the folder. It uses the same byte snapshot for both the hash and the existing analyzer, which still limits input to 100,000 observations and keeps the CSV contract of the earlier set. The hash includes the BOM and line endings, so converting between CRLF and LF may make the hash differ even though the text looks unchanged.

Limitations and advice on evidence

PASS only means that the sidecar, the file bytes and the data checked are consistent with one another. SHA-256 is not a signature . If someone edits both the CSV and the sidecar, a matching pair can still be created. The result therefore keeps capture_completeness=not_proven and boot_identity=operator_label_only_not_verified . There is no evidence that no rows are missing, that there was no reboot, or that the counters at the actual end of the capture are covered.

Keep the original files and the tool version, and use a separate folder for each run. State the clock source, resolution and sync method before comparing times. When a device is available, the boot ID, capture sequence and boundary snapshots must be designed so that the source/recorder actually issues them before a complete capture is claimed. This set does not yet add that data to the firmware. Award 3 points per case for a correct result, for separating observed from declared, and for identifying the missing evidence, giving 12 points in total as a practice rubric; there are no real learner results yet.

See how to compute the hash in Python hashlib and how to distinguish aware/naive time in Python datetime . The limits of the results come from the contract of this practice set; no board, sensor or real flight was measured.

Continue learning and review

Review STM32 Log Diagnostics · Continue with PID, Failsafe and firmware · Back to the advanced overview

Prepare to collect evidence from a real board

Experiment preparation guide for UNO/ESP32/STM32 with worksheets Check the version, wiring, source/core clock and the raw files before drawing conclusions. The guide is ready to use, but the actual upload and measurement are still waiting for equipment.

Practise checking file pairs and separating the layers of evidence

Objective: Check that the CSV and the JSON sidecar are bound by bytes, then separate what is computed from the file, what the author declares, and what cannot yet be proven Prerequisite: Can read the six-column CSV and has completed Log Diagnostics Proposed time: 45–60 minutes; not yet measured with real learners. You can use paper or a CSV/JSON reader; no board or additional installation is needed.

Diagram for checking the SHA and the host time order before separating three layers of evidence: values from the file, declarations, and a capture or boot that is not yet proven

Keep the realistic image and the existing diagram. Use four synthetic sidecar cases and two CSV files with 5 original rows in total. There are no new checker runs or board results.

Download the method for practising provenance checks, the 8-question worksheet, the blank file-pair table, the original reference data and a byte-conversion example and the blank three-layer report template Do these before opening the answers with reasoning, the file-pair answers and the original JSON answers Check the provenance/SHA-256 from manifest

1. Check the CSV/JSON pairs · Q1–Q3

Fill in the table for four pairs, normal/historical/wrong-hash/reversed-time, checking the hash and the time order separately, then count only the rows seen and compute the counter deltas within the same file. Hint: totals of 7→7 and 3→3 are not a new increase of 7/3 in this window. If the hash is wrong or the time goes backwards, keep the original and check the file's history before fixing anything; do not change the digest to cover up a swapped pair.

2. Separate declarations from observations · Q4–Q5

Read origin/source_kit/run_label and the UTC time from the sidecar. State that these are declarations about the source, even though you see that text in a real file. Compute the host span with its unit, but do not subtract it from the callback's age_us to claim latency. Hint: a label set by the author does not confirm a boot ID issued by the board.

3. Changed bytes and missing evidence · Q6–Q7

Read the example that declares an LF→CRLF conversion on a copy in source-records: bytes 105→109, each line of text unchanged, but the hash differs. This is a calculation in PC memory; it does not modify the source file and does not run the validator again. Then explain that a matching byte pair still does not confirm the sender, a complete capture, or a real boot, and write down the additional evidence that must be designed before claiming any of these.

4. Write the three-layer report · Q8

Choose normal or historical and fill in the report template: checkable from the file → declared by the author → not yet proven / additional evidence Cite the file, field, row and window edges so that they can be traced back. Hint: source-records contains additional metadata for reading alongside; it does not replace the source file of the original checker, and the rejected pairs are not included to certify the capture result.

Self-check: This guided set proposes 2 points per question (1 for the answer + 1 for the reason/unit/boundary), 16 in total, separate from the four cases × 3 = 12 criterion of the original set. It is for choosing what to review, not real learner results. This round checked the provenance, bytes, numbers and explanations; there were no runs of the validator/analyzer/compile/firmware/SITL/UART and no new board experiments. When you can explain it, continue to PID, Failsafe and firmware

Choose the next practice set or review

Back to the index of the 10 MCU practice sets to choose a problem according to your goal and the prerequisites you should know, or take the 12-question comprehension assessment to find the topics that should be reviewed.

After checking the answers, record the answers you corrected, the reasons, and what the evidence still does not confirm, then choose the next set that helps answer that question. The worksheet score and the assessment are separate; use them for self-directed selection of review.

Used in courses

How to cite this page

Drone Institute, Rangsit University. (2026). Where logs come from and their scope. In UAS Technology Knowledge Hub (B.Tech.). https://rsu-uat.pk-research.work/en/kb/knowledge/microcontrollers/advanced/log-capture/

Original from Drone-Hub: https://drone.pk-research.work/knowledge/microcontrollers/advanced/log-capture/ · © PK-Research