messages-buffer-max-lines

messages-buffer-max-lines is a variable defined in `subr.el'.
Its value is
1000


Documentation:
Maximum number of lines to keep in the message log buffer.
If nil, disable message logging. If t, log messages but don't truncate
the buffer when it becomes large.

You can customize this variable.