Preskočiť na hlavný obsah

Util to decode multilogs

tail -f /var/.../current | tai64nlocal

but if you want to see e.g. in tinydns IP addresses, use next script...



#!/usr/bin/perl -w

#A program to decode tinydns logfiles
#Written by Sean Hunter 
#Copyright (c) 2001 Uncarved Systems Ltd
#
#This is free software released under version 2 
#of the GPL without warrantees of any kind

use strict;

use IPC::Open2;

#Requires djb's tai64nlocal to be in the path
open2(*READTAI, *WRITETAI, 'tai64nlocal');

my %query_type = (
        '0001' => 'A',
        '0002' => 'NS',
        '0005' => 'CNAME',
        '0006' => 'SOA',
        '000c' => 'PTR',
        '000f' => 'MX',
        '0010' => 'TXT',
        '001c' => 'AAAA',
        '0021' => 'RT',
        '0026' => 'A6',
        '00fb' => 'IXFR',
        '00fc' => 'AXFR',
        '00ff' => '*'
);

my %results = (
        '+' => 'responded',
        '-' => 'not_authority',
        'I' => 'not_implemented/invalid',
        'C' => 'wrong_class',
        '/' => 'not_parsed'
);

while (<>) {
        print WRITETAI $_;
        my $line = ;
        chomp $line;
        if (my ($stamp,$rawip,$port,$id,$result,$type,$name) = $line =~ /^(\S+ \S+) ([^:]+):([^:]+):([^:]+) (\S+) (\S+) (\S+)$/) {
                my $ip = decodeip($rawip);
                my $qtype = $query_type{$type} || $type;
                my $desc = $results{$result};
                $line = sprintf("%s %s %15.15s:%4.4s %-8.8s %-24.24s %s",$stamp,$id,$ip,$port,$qtype,$desc,$name);
        }
        print "$line\n";
}

close READTAI;
close WRITETAI;

sub decodeip
{
        my $rawip = shift;
        my @hexbits = $rawip =~ /(..)(..)(..)(..)/;
        my $text_ip;
        my $sep = '';
        for (@hexbits) {
                $text_ip .= $sep . hex($_);
                $sep = '.';
        }

        $text_ip;
}

Obľúbené príspevky z tohto blogu

mysql 5.0 upgrade to 5.1

The 5.1 series of MySQLwas unmasked for the gentoo portage. When upgrading from an older major version (including 5.0), you will be required to rebuild everything linked to the libmysqlclient.so.15 and libmysqlclient_r.so.15. You can do this by installing app-portage/gentoolkit and running: # revdep-rebuild --library libmysqlclient.so.15 # revdep-rebuild --library libmysqlclient_r.so.15 If you use the Portage 2.2 series, you may also use: # emerge @preserved-rebuild The official upgrade documentation is available here: http://dev.mysql.com/doc/refman/5.1/en/upgrading.html Note that existing databases may need converting as well, again including those upgrading from 5.0 to 5.1.

JDK 8

The goal of this Project is to to produce an open-source reference implementation of the Java SE 8 Platform, to be defined by JSR 337 in the Java Community Process. This Project is sponsored by the Build Group. History and status JDK 8 as presently conceived is the second part of Plan B. The proposed release-driver features are the Lambda and Jigsaw Projects. Additional features will be included, but they must fit into the schedule required for the release drivers. Now that work on JDK 7 is winding down, the next couple of months will be devoted to planning JDK 8 in detail. The proposed JEP Process will be a key part of this effort. Details on how Committers can participate in that process will be available shortly. Plan A: JDK 7 (as currently defined) Mid 2012 Plan B: JDK 7 (minus Lambda, Jigsaw, and part of Coin) Mid 2011 JDK 8 (Lambda, Jigsaw, the rest of Coin, ++) Late 2012