log analysis with perl and wireshark decode.
2010-04-11
130 words
1 min read
Here is something that I had to do in couple of hours to check the logs. The problem was the log file was printing the Received and Sent message in the hex format. I had to verify if the messages were correct. So here is how to do it.
open(FP, ”<$ARGV[0]”)|| die ”File $ARGV[0] does not exist”;
while ($line =)
{if ($line =~ /(Received :)|(Sending :)/)
{
@words = split(/\|/, $words[4]);
$received = $words[1];# Convert to pcap using proprietery software.
system(”tshark -r /tmp/amit.pcap -V|grep -E -i ”Amit\|Agarwal””); # The grep expression only displays the fields of interest.}
Another techique that is quite helpful is to use different color for grep when you are searching for error/warning. This can be done using:
GREP_COLOR=”01;31” && tshark command
[[danscartoon]]
Related Articles:
- 2010/04/11 Bugzilla Automation with perl — add, update or query any bug in Bugzilla using perl and www series modules for perl.
- 2010/03/29 Extract all urls from the last firefox sessionstore.js file used.
- 2010/03/24 Recursive Regular Expressions
- 2010/01/27 Quickly search and replace string with Regular expression in multiple files using perl
- 2010/01/19 Perl script to create csv files with a pattern – Generic script.
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.