]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/logs.cgi/config.dat
5 # This code is distributed under the terms of the GPL
9 # $Id: config.dat,v 1.2.2.10 2005/06/14 12:32:07 eoberlander Exp $
14 # enable only the following on debugging purpose
16 #use CGI::Carp 'fatalsToBrowser';
18 require '/var/ipfire/general-functions.pl';
19 require "${General::swroot}/lang.pl";
20 require "${General::swroot}/header.pl";
27 &Header
::showhttpheaders
();
29 $logsettings{'LOGVIEW_REVERSE'} = 'off';
30 $logsettings{'LOGVIEW_VIEWSIZE'} = '150';
31 $logsettings{'LOGWATCH_LEVEL'} = 'Low';
32 $logsettings{'LOGWATCH_KEEP'} = '56';
33 my @VS = ('15','50','100','150','250','500');
34 $logsettings{'ENABLE_REMOTELOG'} = 'off';
35 $logsettings{'REMOTELOG_ADDR'} = '';
36 $logsettings{'REMOTELOG_PROTOCOL'} = 'udp';
37 $logsettings{'ACTION'} = '';
38 &Header
::getcgihash
(\
%logsettings);
40 if ($logsettings{'ACTION'} eq $Lang::tr
{'save'})
42 if ($logsettings{'ENABLE_REMOTELOG'} eq 'on')
44 unless ( &General
::validfqdn
($logsettings{'REMOTELOG_ADDR'}) ||
45 &General
::validip
($logsettings{'REMOTELOG_ADDR'}))
47 $errormessage = $Lang::tr
{'invalid logserver address'};
49 unless ($logsettings{'REMOTELOG_PROTOCOL'} =~ /^udp|tcp$/)
51 $errormessage = $Lang::tr
{'invalid logserver protocol'};
54 unless ($logsettings{'LOGWATCH_KEEP'} =~ /^\d+$/)
56 $errormessage = $Lang::tr
{'invalid keep time'};
58 unless ($logsettings{'LOGWATCH_LEVEL'} =~ /^Low|Med|High$/)
60 $errormessage = $Lang::tr
{'invalid input'};
62 unless ($errormessage)
64 &General
::writehash
("${General::swroot}/logging/settings", \
%logsettings);
65 system('/usr/local/bin/syslogdctrl') == 0
66 or $errormessage = "$Lang::tr{'bad return code'} " . $?
/256;
71 &General
::readhash
("${General::swroot}/logging/settings", \
%logsettings);
73 $checked{'ENABLE_REMOTELOG'}{'off'} = '';
74 $checked{'ENABLE_REMOTELOG'}{'on'} = '';
75 $checked{'ENABLE_REMOTELOG'}{$logsettings{'ENABLE_REMOTELOG'}} = "checked='checked'";
77 $selected{'REMOTELOG_PROTOCOL'}{'udp'} = '';
78 $selected{'REMOTELOG_PROTOCOL'}{'tcp'} == '';
79 $selected{'REMOTELOG_PROTOCOL'}{$logsettings{'REMOTELOG_PROTOCOL'}} = "selected='selected'";
81 $checked{'LOGVIEW_REVERSE'}{'off'} = '';
82 $checked{'LOGVIEW_REVERSE'}{'on'} = '';
83 $checked{'LOGVIEW_REVERSE'}{$logsettings{'LOGVIEW_REVERSE'}} = "checked='checked'";
85 $selected{'LOGWATCH_LEVEL'}{'Low'} = '';
86 $selected{'LOGWATCH_LEVEL'}{'Med'} = '';
87 $selected{'LOGWATCH_LEVEL'}{'High'} = '';
88 $selected{'LOGWATCH_LEVEL'}{$logsettings{'LOGWATCH_LEVEL'}} = "selected='selected'";
90 map ($selected{'LOGVIEW_VIEWSIZE'}{$_} = '', @VS);
91 $selected{'LOGVIEW_VIEWSIZE'}{$logsettings{'LOGVIEW_VIEWSIZE'}} = "selected='selected'";
93 &Header
::openpage
($Lang::tr
{'log settings'}, 1, '');
95 &Header
::openbigbox
('100%', 'left', '', $errormessage);
98 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
99 print "<font class='base'>$errormessage </font>\n";
103 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
105 &Header
::openbox
('100%', 'left', $Lang::tr
{'log viewing options'});
109 <td><input type='checkbox' name='LOGVIEW_REVERSE' $checked{'LOGVIEW_REVERSE'}{'on'} /></td>
110 <td class='base' width='50%'>$Lang::tr{'reverse sort'}</td>
111 <td class='base' width='25%' align='right'>$Lang::tr{'log lines per page'}: </td>
112 <td width='25%'><select name='LOGVIEW_VIEWSIZE'>
115 foreach my $vs (@VS) {
116 print "\t<option value='$vs' $selected{'LOGVIEW_VIEWSIZE'}{$vs}>$vs</option>\n";
126 &Header
::openbox
('100%', 'left', $Lang::tr
{'log summaries'});
130 <td class='base' width='50%'>$Lang::tr{'summaries kept'}
131 <input type='text' name='LOGWATCH_KEEP'
132 value='$logsettings{'LOGWATCH_KEEP'}' size='4' /> $Lang::tr{'days'}</td>
133 <td>$Lang::tr{'detail level'}:</td><td>
134 <select name='LOGWATCH_LEVEL'>
135 <option value='Low' $selected{'LOGWATCH_LEVEL'}{'Low'}>$Lang::tr{'low'}</option>
136 <option value='Med' $selected{'LOGWATCH_LEVEL'}{'Med'}>$Lang::tr{'medium'}</option>
137 <option value='High' $selected{'LOGWATCH_LEVEL'}{'High'}>$Lang::tr{'high'}</option>
145 &Header
::openbox
('100%', 'left', $Lang::tr
{'remote logging'});
149 <td class='base'>$Lang::tr{'enabled'}</td><td><input type='checkbox' name='ENABLE_REMOTELOG' $checked{'ENABLE_REMOTELOG'}{'on'} /></td>
150 <td>$Lang::tr{'log server address'}</td><td><input type='text' name='REMOTELOG_ADDR' value='$logsettings{'REMOTELOG_ADDR'}' /></td>
151 <td>$Lang::tr{'log server protocol'}</td><td>
152 <select name='REMOTELOG_PROTOCOL'>
153 <option value='udp' $selected{'REMOTELOG_PROTOCOL'}{'udp'}>$Lang::tr{'udp less overhead'}</option>
154 <option value='tcp' $selected{'REMOTELOG_PROTOCOL'}{'tcp'}>$Lang::tr{'tcp more reliable'}</option>
166 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
175 &Header
::closebigbox
();
177 &Header
::closepage
();