Bash Script to parse Perforce Logs

Hi All,

I need to write a bash script that will parse some perforce log files, the log files will contain user login information, the script would need to pare the log, and check who logs in, and if the user is a superadmin, then the script will check the ip address to see which server the superadmin logged into, and if this server is not their home server, it will send an alert out.

my bash skills are not super strong, so I would appreciate some guidance on that.

Regards,

Rob

Show the input you have and the output you want.

And, maybe, your first attempts.

Hi Everyone,

Thanks for your quick responses on the matter, I think I have it for now. I will keep the post open for a day or so in case I face some issues during the scripting, if so I will post my code and the other requested details as well.

Regards,

Rob

As an alternative, you could simply restrict access for a super user to a specific IP address or a range of IP addresses. Have a look at 'p4 protect', the Host column gives you this ability.

If you do not have permission to (or do not want to) restrict the IP address a super user can use, I would probably recommend a script (Python is my preference) to analyse the log, since commands tend to have more than one line in the log (such as start and end).