3 # A form for editing logging options
5 require './squid-lib.pl';
6 $access{'logging'} || &error($text{'elogs_ecannot'});
7 &ui_print_header(undef, $text{'elogs_header'}, "", "edit_logs", 0, 0, 0, &restart_button());
10 print "<form action=save_logs.cgi>\n";
11 print "<table border width=100%>\n";
12 print "<tr $tb> <td><b>$text{'elogs_lalo'}</b></td> </tr>\n";
13 print "<tr $cb> <td><table width=100%>\n";
15 if ($squid_version < 2.6) {
16 # Just a single logging directive
18 print &opt_input($text{'elogs_alf'}, "cache_access_log", $conf, $text{'default'}, 50);
22 # Supports definition of log formats and files
23 @logformat = &find_config("logformat", $conf);
24 $ltable = &ui_radio("logformat_def", @logformat ? 0 : 1,
25 [ [ 1, $text{'elogs_logformat1'} ],
26 [ 0, $text{'elogs_logformat0'} ] ])."<br>\n";
27 $ltable .= &ui_columns_start([ $text{'elogs_fname'},
28 $text{'elogs_ffmt'} ]);
30 foreach $f (@logformat, { }) {
31 ($fname, @ffmt) = @{$f->{'values'}};
32 $ltable .= &ui_columns_row([
33 &ui_textbox("fname_$i", $fname, 20),
34 &ui_textbox("ffmt_$i", join(" ", @ffmt), 60)
38 $ltable .= &ui_columns_end();
39 print "<tr> <td valign=top><b>$text{'elogs_logformat'}</b></td>\n";
40 print "<td colspan=3>$ltable</td> </tr>\n";
43 @access = &find_config("access_log", $conf);
44 $atable = &ui_columns_start([ $text{'elogs_afile'},
46 $text{'elogs_aacls'} ]);
48 foreach $a (@access, { }) {
49 ($afile, $afmt, @aacls) = @{$a->{'values'}};
50 $atable .= &ui_columns_row([
51 &ui_radio("afile_def_$i",
52 !$afile ? 1 : $afile eq "none" ? 2 : 0,
53 [ [ 1, $text{'elogs_notset'} ],
54 [ 2, $text{'elogs_dont'} ],
55 [ 0, &text('elogs_file',
56 &ui_textbox("afile_$i",
57 $afile eq "none" ? "" : $afile,
59 &ui_select("afmt_$i", $afmt,
60 [ [ "", "<".$text{'default'}.">" ],
61 map { [ $_->{'values'}->[0] ] } @logformat ]),
62 &ui_textbox("aacls_$i", join(" ", @aacls), 20)
66 $atable .= &ui_columns_end();
67 print "<tr> <td valign=top><b>$text{'elogs_access'}</b></td>\n";
68 print "<td colspan=3>$atable</td> </tr>\n";
70 print "<tr> <td colspan=4><hr></td> </tr>\n";
71 print "</table><table width=100%>\n";
75 print &opt_input($text{'elogs_dlf'}, "cache_log", $conf, $text{'default'}, 50);
79 $cslv = &find_config("cache_store_log", $conf);
80 $cslm = $cslv->{'value'} eq 'none' ? 2 : $cslv->{'value'} ? 0 : 1;
81 print "<td valign=top><b>$text{'elogs_slf'}</b></td>\n";
82 print "<td nowrap colspan=3>\n";
83 printf "<input type=radio name=cache_store_log_def value=1 %s> %s\n",
84 $cslm == 1 ? "checked" : "", $text{'default'};
85 printf "<input type=radio name=cache_store_log_def value=2 %s> %s\n",
86 $cslm == 2 ? "checked" : "", $text{'elogs_none'};
87 printf "<input type=radio name=cache_store_log_def value=0 %s>\n",
88 $cslm == 0 ? "checked" : "";
89 printf "<input name=cache_store_log size=50 value=\"%s\"></td>\n",
90 $cslm == 0 ? $cslv->{'value'} : "";
94 print &opt_input($text{'elogs_cmf'}, "cache_swap_log", $conf, $text{'default'}, 50);
98 print &choice_input($text{'elogs_uhlf'}, "emulate_httpd_log", $conf,
99 "off", $text{'yes'}, "on", $text{'no'}, "off");
100 print &choice_input($text{'elogs_lmh'}, "log_mime_hdrs", $conf,
101 "off", $text{'yes'}, "on", $text{'no'}, "off");
105 print &opt_input($text{'elogs_ualf'}, "useragent_log", $conf, $text{'none'}, 20);
106 print &opt_input($text{'elogs_pf'}, "pid_filename", $conf, $text{'default'}, 20);
109 if ($squid_version >= 2.2) {
110 @ident = &find_config("ident_lookup_access", $conf);
111 foreach $i (@ident) {
112 local @v = @{$i->{'values'}};
113 if ($v[0] eq "allow") { map { $ila{$_}++ } @v[1..$#v]; }
114 elsif ($v[0] eq "deny" && $v[1] ne "all") { $bad_ident++; }
117 print "<tr><td valign=top><b>$text{'elogs_prilfa'}</b></td> <td colspan=3>\n";
118 @acls = &find_config("acl", $conf);
119 unshift(@acls, { 'values' => [ 'all' ] })
120 if ($squid_version >= 3);
121 foreach $acl (@acls) {
122 $aclv = $acl->{'values'}->[0];
123 next if ($doneacl{$aclv}++);
124 printf "<input type=checkbox name=ident_lookup_access ".
125 "value=$aclv %s>$aclv\n",
126 $ila{$aclv} ? "checked" : "";
128 print "</td> </tr>\n";
130 else { print "<input type=hidden name=complex_ident value=1>\n"; }
132 print &opt_time_input($text{'elogs_rit'}, "ident_timeout",
133 $conf, $text{'default'}, 6);
137 print &choice_input($text{'elogs_dril'}, "ident_lookup", $conf,
138 "off", $text{'yes'}, "on", $text{'no'}, "off");
140 print &choice_input($text{'elogs_lfh'}, "log_fqdn", $conf,
141 "off", $text{'yes'}, "on", $text{'no'}, "off");
145 print &opt_input($text{'elogs_ln'}, "client_netmask", $conf, $text{'default'}, 15);
146 print &opt_input($text{'elogs_do'}, "debug_options", $conf, $text{'default'}, 15);
149 if ($squid_version >= 2) {
151 print &opt_input($text{'elogs_mht'}, "mime_table",
152 $conf, $text{'default'}, 20);
156 print "</table></td></tr></table>\n";
157 print "<input type=submit value=$text{'buttsave'}></form>\n";
159 &ui_print_footer("", $text{'elogs_return'});