Run the replace on the log line string instead of the separate
parts since we can ensure the line is a string.
Signed-off-by: Jason Robinson <jasonr@matrix.org>
If an individual log is larger than the max size, ignore the rest
of it. Also build the string as we go rather than joining it all
together at the end, that way we only need the whole string + one
chunk in memory at once, rather than the whole string x 2.