parse a log file and split it by individual log entry. The log entry can be a single line or multiple lines. In addition separate out the timestamp from the rest of the message.

- Must not load entire file in memory (stream)
- Must capture the entire entry (single and multiple lines)
- Must split the entry also in two parts, timestamp and the rest of the entry
- Must use a regular expression to parse
- Must be configurable to parse log files in slightly different formats

example input(part of the log file):

[18/09/2011 06:53:21:021 PM] ERROR Main 70: Running logger, watch out!
java.lang.IndexOutOfBoundsException: Index: 99, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
[18/09/2011 06:53:21:021 PM] INFO Main 73: Running logger, watch out!
[18/09/2011 06:53:21:021 PM] INFO Main 73: Identity manager starting.

and output 3 log entries:
1 -
[18/09/2011 06:53:21:021 PM] ERROR Main 70: Running logger, watch out!
java.lang.IndexOutOfBoundsException: Index: 99, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
2 -
[18/09/2011 06:53:21:021 PM] INFO Main 73: Running logger, watch out!
3 -
[18/09/2011 06:53:21:021 PM] INFO Main 73: Identity manager starting.


My questions:

1. if I use below to read log file, is it correct to meet the requirement (- Must not load entire file in memory (stream))?
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
// process the line.
}
br.close();

2. can I save timestamp and the rest of the entry to a HashMap<String, ArrayList<String>>? and key is the timestamp, the rest of entry is saved to ArrayList?
but if the log file is big, the HashMap should be very big, maybe it is not a good way.

3. how can I save the result? Can I save the result to a new log file (every entry has a number)?

Thanks