In the interface I designed, I Insert the data on the textbox as I filtered in the log file. Features I've done so far: I filter by word only and filter by start date.
However, I want to output the lines containing the word I want to search between the exact property start date and the end date I want.
For example, my keyword is AppEngine. Also, I want to filter between 07/19/22 08:40:49 to 07/19/22 08:50:49.
So the output should be like this
[07/19/22 08:40:49.785667 ] [debug ] [1422] [AppEngine.c:257] [eventNotify] ENTERED
[07/19/22 08:40:49.785702 ] [debug ] [1422] [AppEngine.c:262] [eventNotify] Event notified eventId: 290
[07/19/22 08:40:49.785736 ] [debug ] [1422] [AppEngine.c:271] [eventNotify] Event identified eventId: 290
[07/19/22 08:40:49.785770 ] [debug ] [1422] [AppEngine.c:282] [eventNotify] LEAVED
How can I write the ending date state?
My log file example here:
[07/19/22 08:40:49.785667 ] [debug ] [1422] [AppEngine.c:257] [eventNotify] ENTERED
[07/19/22 08:40:49.785702 ] [debug ] [1422] [AppEngine.c:262] [eventNotify] Event notified eventId: 290
[07/19/22 08:40:49.785736 ] [debug ] [1422] [AppEngine.c:271] [eventNotify] Event identified eventId: 290
[07/19/22 08:40:49.785770 ] [debug ] [1422] [AppEngine.c:282] [eventNotify] LEAVED
[07/19/22 08:40:49.785936 ] [debug ] [1422] [SoftwareManagement.c:236] [requestAppToProcessRruSoftwareInformation] LEAVED
[07/19/22 08:40:49.785959 ] [debug ] [1422] [SwmUkaEventHandler.c:1501] [handleUkaSWMRRUVersionListInformRequestReceived] handleUkaSWMRRUVersionListInformRequestReceived return value = 0
[07/19/22 08:40:49.785971 ] [debug ] [1422] [SwmUkaEventHandler.c:1501] [handleUkaSWMRRUVersionListInformRequestReceived] LEAVED
[07/19/22 08:40:49.785983 ] [debug ] [1426] [UKAInterface.c:483] [receiveMessageFromAKA] Received data size: 14
[07/19/22 08:40:49.785995 ] [debug ] [1426] [UKAInterface.c:687] [mergeMessageChunks] uChunkSize: 5
My Function is :
#function to search string in text
def search(msg, startingDate, endingDate):
with open(r"OAM.log", 'r', encoding='latin1') as fp:
for l_no, line in enumerate(fp):
lineNum = l_no + 1
if msg in line and var1.get() == 1 and (var2.get() == 0):
text.insert('1.0', f"Line Number: {lineNum} Log: {line} \n ")
elif startingDate in line and (var2.get() == 1):
if msg in line and (var1.get() == 1):
text.insert('1.0', f"Line Number: {lineNum} Log: {line} \n ")
def getInfo():
msg = edit.get()
startingDate = tarih1.get()
endingDate = tarih2.get()
search(msg, startingDate, endingDate)
butt.config(command=getInfo)
