The line fastened to the log (q.v.), and wound round a reel in the ship's gallery. The whole line (except some five fathoms next the log, called stray line) is divided into equal lengths called knots, each of which is marked with a piece of coloured tape or bunting. Suppose the captain wishes to know the rate of his ship; one of the sailors throws the log into the sea, and the reel begins to unwind. The length of line run off in half a minute shows the rate of the ship's motion per hour.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894
More on Log-line from Fact Monster: