Bash Script to parse Perforce Logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash Script to parse Perforce Logs
# 1  
Old 06-06-2016
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
# 2  
Old 06-06-2016
Show the input you have and the output you want.
# 3  
Old 06-06-2016
And, maybe, your first attempts.
# 4  
Old 06-06-2016
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
# 5  
Old 06-06-2016
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).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

BASH script to parse XML and generate CSV

Hi All, Hope all you are doing good! Need your help. I have an XML file which needs to be converted CSV file. I am not an expert of awk/sed so your help is highly appreciated!! XML file looks like this: <l:event dateTime="2013-03-13 07:15:54.713" layerName="OSB" processName="ABC"... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

2. Shell Programming and Scripting

Perl script to parse multiple windows event logs.

Hi all, I am developing a log parsing agent in perl to send windows Event logs to Zenoss Monitoring tool. Using Win32::EventLog i can able to get the Event messages but only one Eventype eg Application or System could able to parse at a time. Can you please help to how to open mutiple eventlogs... (3 Replies)
Discussion started by: kar_333
3 Replies

3. Shell Programming and Scripting

sed script to parse logs issue

I have this script to parse some logs: #!/bin/bash id=$1 shift sed "/(id=$id)/,/^$/!d" "$@" Usage: ./script.sh 1234 logfile The logs have an empty line before the logged events/timestamps -- most of the time. And this is my issue, since when there is no empty line, it will catch things... (4 Replies)
Discussion started by: KidCactus
4 Replies

4. Shell Programming and Scripting

bash script logs

Hi, I have a bash script and I am run it manually. It starts, but actually is doing nothing, probably because of a wrong input parameter.....Is there a place /directory/file where I can see a log for the script? (1 Reply)
Discussion started by: apenkov
1 Replies

5. Shell Programming and Scripting

Bash Script for parse input like option and value

I would create a bash script than parse like this: test.sh -p (protocol) -i (address) -d (directory) I need retrive the value after -p for example... understand??? I hope... thanks (6 Replies)
Discussion started by: ionral
6 Replies

6. UNIX for Dummies Questions & Answers

bash script to parse sequence...

Hi, I have 4000 list files and 4000 sequence data files. Each list file contains a number of 'headers' and data file contains 'header and data'. I would like to extract data from the data file using the list file and write into a new file. As each of the files are quite large, an efficient piece... (6 Replies)
Discussion started by: Fahmida
6 Replies

7. Shell Programming and Scripting

Bash Shell Script to parse file

Raw Results: results|192.168.2|192.168.2.1|general/udp|10287|Security Note|For your information, here is the traceroute from 192.168.2.24 to 192.168.2.1 : \n192.168.2.24\n192.168.2.1\n\n results|192.168.2|192.168.2.1|ssh (22/tcp)|22964|Security Note|An SSH server is running on this port.\n... (2 Replies)
Discussion started by: jroberson
2 Replies

8. Shell Programming and Scripting

Bash Script to read a file and parse each record

Hi Guys, I am new to unix scripting and I am tasked to parse through a CSV file delimited by #. Sample: sample.csv H#A#B#C D#A#B#C T#A#B#C H = Header D = Detail Record T = Tail What I need is to read the file and parse through it to get the columns. I have no idea on how... (8 Replies)
Discussion started by: 3vilwyatt
8 Replies

9. Shell Programming and Scripting

Need to Parse XML from bash script

I am completely new to bash scripting and now need to write a bash script that would parse a XML file and take out values from specific tags. I tried using xsltproc, xml_grep commands. But the issue is that the XML i am trying to parse is not UTF 8. so those commands are unable to parse my XML's... (4 Replies)
Discussion started by: shivashankar.g
4 Replies

10. Shell Programming and Scripting

How do you parse a variable in a bash script?

I have a script I use on my web server (Apache2). I am changing to Lighttpd and need to make a few changes. This is what I use on my apache server #!/bin/bash # accepts 3 parameters: <domain name> <user name> <XXXXXXXX> # domain name is without www (just domain.com) # username would be... (3 Replies)
Discussion started by: vertical98
3 Replies
Login or Register to Ask a Question