Striplog onder Linux

Pagina: 1
Acties:

  • FutureCow
  • Registratie: December 2000
  • Laatst online: 22:44

FutureCow

(C) FutureCow

Topicstarter
striplog
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
!/usr/bin/perl
#
# striplog2.pl
# 2001-02-03 Vragen&opmerkingen naar: pinball@cheerful.com
# Lees striplog2.txt voor info.

# 1: projecten
#$rc5 = 1; <-- wel RC5
#$rc5 = 0; <-- geen RC5

$rc5 = 1;
$ogr = 0;

# 2: maak deze gelijk aan wat achter:
# 'logfilekeyblock='
# staat in je proxyper.ini (kijk bij [RC5] en [OGR] in je proxyper.ini)
$rc5log = "pproxyrc572";
$ogrlog = "pproxyogr";

# 3: oude logs: (vul aantal dagen in, bv logs van 1 jaar: $oudelogs = 365);
# Bij 'normale' werking moet hier een 0 staan, alleen veranderen om oude logs te doen.
$oudelogs = 1;

# 4
# Zie hieronder, bij: "Vul hieronder zelf de ip-ranges aan.",
# Vergeet niet je rc5-dns.cache (en eventueel ogr-dns.cache) aan te passen.

# Klaar!

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = nice_time(time);
if (!$isdst) {
        $uurcorr = 3600;
} else {
        $uurcorr = 7200;
}

#deze alleen veranderen als je weet wat je aan het doen bent :-)
$rc5small = "Outrc5";
$ogrsmall = "pinproxyogr";
#
for ($dagen = 0; $dagen <= $oudelogs; $dagen++) {
        ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = nice_time(time-$uurcorr-($dagen * 86400));
        $curdate = "$year$mon$mday";
        if ($rc5) {
                $biglog  = $rc5log . $curdate . ".log";
                $smallog = $rc5small . $curdate . ".log";
                if (!-e $smallog && !$oudelogs) {
                        $oudelogs = 1;
                }
                proclog($biglog, $smallog);
        }
        if ($ogr) {
                $biglog  = $ogrlog . $curdate . ".log";
                $smallog = $ogrsmall . $curdate . ".log";
                if (!-e $smallog && !$oudelogs) {
                        $oudelogs = 1;
                }
                proclog($biglog, $smallog);
        }
}



sub proclog {
undef %full;
undef %final;

my($voor, $na) = @_;

open (LEES, '<'."$voor") or print "Kan de proxylogs niet lezen: $voor\n";
while (defined($entry = <LEES>)) {
        chomp($entry);
        $entry =~ tr/A-Z/a-z/;
        ($datetime, $ipaddr, $email, $block, $nkeys, $os, $cpu, $ver, $space) = split(/,/, $entry);

blablabla


de error die ik dan krijg:

Bareword found where operator expected at striplog2.pl line 1, near "/usr/bin"
(Missing operator before bin?)
syntax error at striplog2.pl line 1, near "/usr/bin"
Illegal character \015 (carriage return) at striplog2.pl line 11.
(Maybe you didn't strip carriage returns after a network transfer?)

wat is het probleem?

[ Voor 20% gewijzigd door FutureCow op 14-02-2003 08:22 ]


  • stappel_
  • Registratie: Augustus 2000
  • Laatst online: 12-05 17:45
je mist ten eerste een # voor de eerste !.
maar daarnaast heb je de file binary overgehaald en dat moet in ascii gebeuren.

Ubero: #2, Euler: #1, GOT: #1, Des: #1, Zeta: #1, Eon: #3, OGR-24: #3, OGR-25: #7,
LM: #7, AP: #5, DF: #19, D2OL: #37, SOB: #50, TSC: #63, RC5: #96


  • FutureCow
  • Registratie: December 2000
  • Laatst online: 22:44

FutureCow

(C) FutureCow

Topicstarter
idd lag aan binary transfer, bedankt