Skip to the workspace
Pebellslearn by building
Sources of Data  ›  Capstone Project

Logs, Mobile Apps and IoT

Logs 12 minEvent data from logs, mobile apps and devices can arrive late, duplicated and out of order, so pipelines deduplicate by ID, group by event time and allow a lateness window.

data engineer / Logs, Mobile Apps and IoT

Explore each scene at your own pace.

01 · The rule

The rule

Logs, Mobile Apps and IoT

PedalCity's dock sensors report every 30 seconds, the mobile app records taps, and the servers write log lines. This is event data: a record of something that happened at a moment in time. It is the largest source PedalCity has, and the least tidy. A phone in a tunnel keeps its events for an hour. A sensor that did not hear an acknowledgement sends the same reading twice.

The rule

Events arrive late, twice, and out of order — design for it.

Every event carries two times:

  • Event time: when it actually happened, stamped by the device.
  • Arrival time: when your pipeline received it.

They can be far apart. A rider taps "unlock" at 08:02 in an underground car park, and the phone uploads the event at 09:10. Count by arrival time and the tap lands in the 09:00 hour, so 08:00 looks too quiet and 09:00 too busy.

{"event_id": "e-7f3a", "type": "unlock_tapped", "rider_id": 5521,
 "event_time": "2026-09-24T08:02:11+05:30",
 "arrival_time": "2026-09-24T09:10:57+05:30"}

Three habits handle the mess:

  1. Deduplicate by a unique ID. Give each event an event_id at the source. If the same ID arrives twice, keep one copy.
  2. Group by event time, not arrival time, when the question is about when things happened.
  3. Allow lateness. Keep each hour's result open for a while, say two hours, and recompute it when late events arrive.

Logs add one more step. Server logs are text lines that must be parsed into fields before they are useful, and lines can be malformed:

2026-09-24 08:14:03 INFO dock=17-04 bike=903 action=docked

Device clocks also drift. A sensor with a wrong clock can send "future" events, so check timestamps against sensible bounds.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.