If I am continually parsing a log file and I detect that it has rotated, what is the best practice for handling this?

1. Update my internal hashmap to reflect a new filePointer (end of
rotated file)
2. Or should I update the hashmap to 0 so it can read the
rotated file from the start

My concern is that in the case of an anomaly in situation no. 2 mentioned above, I may indirectly parse a large file from the start and put significant load on the host.
However if I use no. 1 I may miss something critical that I was parsing the log file for.

This is the code that I've put together.

```
currentFilePointer = util.FileManagement.getLastFilePointerFromFile(file.getName());
lastFilePointer = Long.parseLong(lastReadFiles_.get(file.getName()).toString());

if (currentFilePointer < lastFilePointer) // file has grown
{
     processLineByLine(file.getName(), currentFilePointer, lastFilePointer);
} else if (currentFilePointer > lastFilePointer) // file has been rotated
{
     lastReadFiles_.put(file.getName(), currentFilePointer); // Option 1
 }

```