Log as in keeping a record of something is from the Greek word logos, meaning account (among other things).
The original device to measure speed in a boat was throwing a log off the bow and counting how much time it took to reach the stern or a similar method. This evolved to a log tied to a rope with knots tied a set distance apart.
That evolved to a small triangular board tied at each corner for better drag in the water and is called a chip log.

The knots were tied at intervals according to the unit of distance used and the length of time you measured. In modern units (Nautical Mile 6076 feet) a 20 second timer would mean knots 33 feet 8 inches apart.
Throw the log in the water, start the timer when the start mark passes through your hand and then count the knots that pass your hand until time expires.
Speed is reported to the captain in knots. The measurements were recorded and the record came to be called the logbook.
I made one for my small sailboat on Lake Michigan 25 years ago just for fun.
PS This is why nautical miles per hour is referred to as "knots"