Need some help with a log regex

Post Reply
threecats
Junior Member
Posts: 2
Joined: 12 Oct 2024, 16:21

Need some help with a log regex

Post by threecats »

Can someone provide a regex that handles this line in /var/log/secure? I tried a couple of things, and don't seem to get it, even trying to copy and adapt one that's already there. Here's the line:

Nov 11 13:00:01 boston systemd[2322963]: pam_unix(systemd-user:session): session opened for user root(uid=0) by root(uid=0)

I'm getting these in LFD Log Scanner reports
Sergio
Junior Member
Posts: 1712
Joined: 12 Dec 2006, 14:56

Re: Need some help with a log regex

Post by Sergio »

What are you looking for the REGEX to do with that info?

Sergio
threecats
Junior Member
Posts: 2
Joined: 12 Oct 2024, 16:21

Re: Need some help with a log regex

Post by threecats »

I think we got it solved. Basically, since those messages are being generated from Cron jobs, my goal was to filter them out of the (secure) log file, without removing them from the log itself.

Here's the regex we came up with, which seems to be working:

^(\S+|\S+\s+\d+\s+\S+) [^\s\.]+ systemd\[[[:digit:]]+\]: pam_unix\(systemd-user:session\): session opened for user root\(uid=0\) by root\(uid=0\)

I also created one for mailman, since we're not using it on this server.
Post Reply