5 require './squid-lib.pl';
6 $access{'logging'} || &error($text{'elogs_ecannot'});
8 &lock_file($config{'squid_conf'});
10 $whatfailed = $text{'slogs_ftslo'};
12 if ($squid_version < 2.6) {
13 # Just a single logging directive
14 &save_opt("cache_access_log", \&check_file, $conf);
17 # Supports definition of log formats and files
18 for($i=0; defined($fname = $in{"fname_$i"}); $i++) {
19 $ffmt = $in{"ffmt_$i"};
21 $fname =~ /^\S+$/ || &error(&text('slogs_efname', $i+1));
22 $ffmt =~ /\S/ || &error(&text('slogs_effmt', $i+1));
23 push(@logformat, { 'name' => 'logformat',
24 'values' => [ $fname, $ffmt ] });
26 &save_directive($conf, "logformat", \@logformat);
29 for($i=0; defined($afile = $in{"afile_$i"}); $i++) {
30 $adef = $in{"afile_def_$i"};
32 $adef == 2 || $afile =~ /^\/\S+$/ ||
33 &error(&text('slogs_eafile', $i+1));
34 $afmt = $in{"afmt_$i"};
35 $aacls = $in{"aacls_$i"};
37 { 'name' => 'access_log',
38 'values' => [ $adef == 2 ? "none" : $afile,
40 $aacls ? ( "squid" ) : ( ),
41 split(/\s+/, $aacls) ] } );
43 &save_directive($conf, "access_log", \@access);
46 &save_opt("cache_log", \&check_file, $conf);
47 if ($in{'cache_store_log_def'} == 2) {
48 &save_directive($conf, "cache_store_log",
49 [ { 'name' => 'cache_store_log',
50 'values' => [ "none" ] } ]);
53 &save_opt("cache_store_log", \&check_file, $conf);
55 &save_opt("cache_swap_log", \&check_file, $conf);
56 &save_choice("emulate_httpd_log", "off", $conf);
57 &save_choice("log_mime_hdrs", "off", $conf);
58 &save_opt("useragent_log", \&check_file, $conf);
59 &save_opt("pid_filename", \&check_pid_file, $conf);
60 if ($squid_version >= 2.2) {
61 if (!$in{'complex_ident'}) {
62 local @ila = split(/\0/, $in{'ident_lookup_access'});
63 &save_directive($conf, "ident_lookup_access", !@ila ? [ ] :
64 [ { 'name' => 'ident_lookup_access',
65 'values' => [ 'allow', @ila ] } ]);
67 &save_opt_time("ident_timeout", $conf);
70 &save_choice("ident_lookup", "off", $conf);
72 &save_choice("log_fqdn", "off", $conf);
73 &save_opt("client_netmask", \&check_netmask, $conf);
74 &save_opt("debug_options", \&check_debug, $conf);
75 if ($squid_version >= 2) {
76 &save_opt("mime_table", \&check_file, $conf);
80 &unlock_file($config{'squid_conf'});
81 &webmin_log("logs", undef, undef, \%in);
86 return $_[0] eq 'none' ? undef : &check_file($_[0]);
91 $_[0] =~ /^\// || return &text('slogs_emsg1',$_[0]);
92 $_[0] =~ /^(\S*\/)([^\/\s]+)$/ || return &text('slogs_emsg2',$_[0]);
93 (-d $1) || return &text('slogs_emsg3',$1);
99 &check_ipaddress($_[0]) || return &text('slogs_emsg4',$_[0]);
105 $_[0] =~ /\S+/ || return &text('slogs_emsg5',$_[0]);