2020-10-31

Having trouble with parsing specific data from log file

I have an assignment in which the main task is to report suspicious activities within a log file. There are several other problems I have to address, but the one that I want to focus on the most is "suspicious activities" (if I can get a grasp on this then more than likely I'll have a lightbulb to help guide me on the rest). The way this is supposed to be achieved is to keep up a count for whenever a user logins between 12:00 am to 5:00 am. Once a user has been marked for being suspicious, the users' name, their email, and the domain name should be present as output information.

I have never worked with log files before and this is my first dealing with one using Python 3 (specifically PyCharm). So far it has proven challenging because I don't know where exactly to start this assignment. I originally planned to use regular expressions to match specific text in the log file and dictionaries for keys, but I wasn't sure if this was the correct frame of mind in tackling this assignment.

Here is the sample log: Sample Behavior

And here is a piece of the user log file userlog.log

I apologize if my post comes off as a bit confusing, this is the very first time I have used Stack overflow. My goal is to gather thoughts and ideas of how I should tackle this assignment one step at a time. Thanks for any ideas or thoughts as well. Edit: below is a piece of the user log file pasted.

2020-05-23 00:44:42 login mailserver.local melaina.gabeline@yahoo.com.mx
2020-05-15 10:54:11 logout mailserver.local sevan.stephco@miho-nakayama.com
2020-05-07 11:25:24 login myworkstation.local breena.benassi@gmx.net
2020-05-14 16:31:34 logout webserver.local arti.karshner@mail2perry.com
2020-05-12 17:02:10 login mailserver.local queen.ham@quiklinks.com
2020-05-30 23:01:30 logout mailserver.local maryelizabeth.stassen@freesurf.fr
2020-05-11 15:04:32 logout myworkstation.local lupe.gave@freesurf.fr
2020-05-26 13:51:35 logout mailserver.local tarrin.evanoff@blacksburg.net
2020-05-15 02:21:39 logout mailserver.local maryelizabeth.stassen@freesurf.fr
2020-05-05 14:16:13 login mailserver.local aprilmarie.ulatowski@freesurf.fr
2020-05-21 03:53:37 login mailserver.local tarrin.naysmith@mail2champaign.com
2020-05-05 06:17:09 login webserver.local melaina.gabeline@yahoo.com.mx
2020-05-24 18:24:49 logout myworkstation.local kira.pay@mail2zambia.com



from Recent Questions - Stack Overflow https://ift.tt/37TUWb6
https://ift.tt/eA8V8J

No comments:

Post a Comment