#!/usr/bin/perl # http://perlmonks.org/?node_id=1207042 use strict; use warnings; my (%services, %bydate); while() { /^(.{15}) (\S+) ([\w-]+)/ or next; $services{$3}++; $bydate{$1}{count}++; $bydate{$1}{$3}++; } my @services = reverse sort keys %services; print "Time Number_of_times_timestamp_appeared @services\n"; for my $key ( sort keys %bydate ) { print "$key $bydate{$key}{count} @{[ map $bydate{$key}{$_} // 0, @services ]}\n"; } __DATA__ Jan 7 04:13:02 centos1 rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="1453" x-info="http://www.rsyslog.com"] rsyslogd was HUPed Jan 7 04:15:41 centos1 puppet-agent[5467]: Unable to fetch my node definition, but the agent run will continue: Jan 7 04:15:41 centos1 puppet-agent[5467]: getaddrinfo: Name or service not known Jan 7 13:16:01 centos1 puppet-agent[9305]: (/File[/var/lib/puppet/lib]) Could not evaluate: Could not retrieve file metadata for puppet://puppet/plugins: getaddrinfo: Name or service not known Jan 7 13:16:02 centos1 dhclient[1624]: DHCPREQUEST on eth0 to 192.168.0.1 port 67 (xid=0xf27d6e5) Jan 7 13:16:15 centos1 dhclient[1624]: DHCPREQUEST on eth0 to 192.168.0.1 port 67 (xid=0xf27d6e5)