Event based python code

Hi,
I’m trying to develop a python application for the Digi WR41 with a telemetry card 2 that allows me to set to high an output on the telemetry card when an specific event happens on the transport. As of now the code is not working properly because is inspecting the whole event log file instead of just the most recent event. Is there a way of monitoring only the most recent event rather than the whole file?. Below is the python code that i have developed so far:

import digihw
import sarcli
import time

Constants

DIO1 = 0

def main():

# This is what we are looking for in the eventlog.txt
string_match1 = "ETH 0 Out Of Service,Ethernet"

filename = “eventlog.txt”

# Do forever
while True:
    # Try to open the eventlog.txt file, 'r' stands for "reading"

        filelog = open(filename, 'r')
        str = filelog.read() #read the file one line at a time

   # Check the eventlog.txt file for the string_match value.  
       
       if string_match1 in str:
            digihw.gpio_set_value(DIO1,1) 
        filelog.close()
        time.sleep (1)     

if name == ‘main’:
main()