Or more accurately, how I used Google AI mode to do it. Then after iterating a few times, changing the approach, and debugging it, I had it generate this generic version, and this blog post, including everything after this intro block. Honestly, it would have taken me more than a day to do this. Using Google AI mode and some iterations it was done in a few hours. It all started with this question: “is it possible to use AI tools to review raw logwatch logs and filter them, opting to only be notified if something actually required manual human attention.” It was really interesting to iterate over various approaches. Pretty cool. Anyway, over to you, AI…
Edit: There were some bugs – permissions on the local logwatch files didn’t work (UMask didn’t do it) and in the end I needed to edit the cron.daily 00logwatch to both not send email, and chown the result file to the user pulling the files. And there is a bug in parse_logs.py line 98, inbase_name = os.path.splitext(filename).upper() needs to be base_name = os.path.splitext(filename)[0].upper()
Also looks like the server name for flagged errors isn’t getting into the email, and it’s flagging non-errors (ssh attempts for unallowed users, successful ssh for allowed users) as actionable log messages. More revisions needed! I’ll talk to the AI later. This is going to show up in the annual performace review!
Edit 2: Many iterations later, I have a much cleaner version that works consistently and has lots of error checking. Now, if only I could get it to generate a clean blog post.

Leave a Reply
You must be logged in to post a comment.