Perhaps something like a log?
Here you find a basic example. One post later you find the code to limit the amount of rows to keep.