Add option to get last N lines from console output, using a buffer