Tomato 1.28
[tomato/tomato-null.git] / release / src / router / www / admin-log.asp
blob86c85937cc0d1a4677b68a704a8175a8e74054ae
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <title>[<% ident(); %>] Admin: Logging</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <link rel='stylesheet' type='text/css' href='color.css'>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
21 <script type='text/javascript' src='debug.js'></script>
23 <script type='text/javascript'>
25 // <% nvram("log_remote,log_remoteip,log_remoteport,log_file,log_limit,log_in,log_out,log_mark,log_events"); %>
27 function verifyFields(focused, quiet)
29 var a, b;
31 a = E('_f_log_file').checked;
32 b = E('_f_log_remote').checked;
34 a = !(a || b);
35 E('_log_in').disabled = a;
36 E('_log_out').disabled = a;
37 E('_log_limit').disabled = a;
38 E('_log_mark').disabled = a;
39 E('_f_log_acre').disabled = a;
40 E('_f_log_crond').disabled = a;
41 E('_f_log_dhcpc').disabled = a;
42 E('_f_log_ntp').disabled = a;
43 E('_f_log_pppoe').disabled = a;
44 E('_f_log_sched').disabled = a;
46 elem.display(PR('_log_remoteip'), b);
47 E('_log_remoteip').disabled = !b;
48 E('_log_remoteport').disabled = !b;
50 if (a) return 1;
52 if (!v_range('_log_limit', quiet, 0, 2400)) return 0;
53 if (!v_range('_log_mark', quiet, 0, 1440)) return 0;
54 if (b) {
55 if ((!v_ip('_log_remoteip', quiet)) || (!v_port('_log_remoteport', quiet))) return 0;
57 return 1;
60 function save()
62 var a, fom;
64 if (!verifyFields(null, false)) return;
66 fom = E('_fom');
67 fom.log_remote.value = E('_f_log_remote').checked ? 1 : 0;
68 fom.log_file.value = E('_f_log_file').checked ? 1 : 0;
70 a = [];
71 if (E('_f_log_acre').checked) a.push('acre');
72 if (E('_f_log_crond').checked) a.push('crond');
73 if (E('_f_log_dhcpc').checked) a.push('dhcpc');
74 if (E('_f_log_ntp').checked) a.push('ntp');
75 if (E('_f_log_pppoe').checked) a.push('pppoe');
76 if (E('_f_log_sched').checked) a.push('sched');
77 fom.log_events.value = a.join(',');
79 form.submit(fom, 1);
81 </script>
83 </head>
84 <body>
85 <form id='_fom' method='post' action='tomato.cgi'>
86 <table id='container' cellspacing=0>
87 <tr><td colspan=2 id='header'>
88 <div class='title'>Tomato</div>
89 <div class='version'>Version <% version(); %></div>
90 </td></tr>
91 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
92 <td id='content'>
93 <div id='ident'><% ident(); %></div>
95 <!-- / / / -->
97 <input type='hidden' name='_nextpage' value='admin-log.asp'>
98 <input type='hidden' name='_service' value='logging-restart'>
100 <input type='hidden' name='log_remote'>
101 <input type='hidden' name='log_file'>
102 <input type='hidden' name='log_events'>
104 <script type='text/javascript'>
105 </script>
107 <div class='section-title'>Syslog</div>
108 <div class='section'>
109 <script type='text/javascript'>
111 // adjust (>=1.22)
112 nvram.log_mark *= 1;
113 if (nvram.log_mark >= 120) nvram.log_mark = 120;
114 else if (nvram.log_mark >= 60) nvram.log_mark = 60;
115 else if (nvram.log_mark > 0) nvram.log_mark = 30;
116 else nvram.log_mark = 0;
118 createFieldTable('', [
119 { title: 'Log Internally', name: 'f_log_file', type: 'checkbox', value: nvram.log_file == 1 },
120 { title: 'Log To Remote System', name: 'f_log_remote', type: 'checkbox', value: nvram.log_remote == 1 },
121 { title: 'IP Address / Port', indent: 2, multi: [
122 { name: 'log_remoteip', type: 'text', maxlen: 15, size: 17, value: nvram.log_remoteip, suffix: ':' },
123 { name: 'log_remoteport', type: 'text', maxlen: 5, size: 7, value: nvram.log_remoteport } ]},
124 { title: 'Generate Marker', name: 'log_mark', type: 'select', options: [[0,'Disabled'],[30,'Every 30 Minutes'],[60,'Every 1 Hour'],[120,'Every 2 Hours']], value: nvram.log_mark },
125 { title: 'Events Logged', text: '<small>(some of the changes will take effect after a restart)</small>' },
126 { title: 'Access Restriction', indent: 2, name: 'f_log_acre', type: 'checkbox', value: (nvram.log_events.indexOf('acre') != -1) },
127 { title: 'Cron', indent: 2, name: 'f_log_crond', type: 'checkbox', value: (nvram.log_events.indexOf('crond') != -1) },
128 { title: 'DHCP Client', indent: 2, name: 'f_log_dhcpc', type: 'checkbox', value: (nvram.log_events.indexOf('dhcpc') != -1) },
129 { title: 'NTP', indent: 2, name: 'f_log_ntp', type: 'checkbox', value: (nvram.log_events.indexOf('ntp') != -1) },
130 { title: 'PPPoE', indent: 2, name: 'f_log_pppoe', type: 'checkbox', value: (nvram.log_events.indexOf('pppoe') != -1) },
131 { title: 'Scheduler', indent: 2, name: 'f_log_sched', type: 'checkbox', value: (nvram.log_events.indexOf('sched') != -1) },
132 { title: 'Connection Logging' },
133 { title: 'Inbound', indent: 2, name: 'log_in', type: 'select', options: [[0,'Disabled (recommended)'],[1,'If Blocked By Firewall'],[2,'If Allowed By Firewall'],[3,'Both']], value: nvram.log_in },
134 { title: 'Outbound', indent: 2, name: 'log_out', type: 'select', options: [[0,'Disabled (recommended)'],[1,'If Blocked By Firewall'],[2,'If Allowed By Firewall'],[3,'Both']], value: nvram.log_out },
135 { title: 'Limit', indent: 2, name: 'log_limit', type: 'text', maxlen: 4, size: 5, value: nvram.log_limit, suffix: ' <small>(messages per minute / 0 for unlimited)</small>' }
137 </script>
138 </div>
140 <!-- / / / -->
142 </td></tr>
143 <tr><td id='footer' colspan=2>
144 <span id='footer-msg'></span>
145 <input type='button' value='Save' id='save-button' onclick='save()'>
146 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
147 </td></tr>
148 </table>
149 </form>
150 <script type='text/javascript'>verifyFields(null, 1);</script>
151 </body>
152 </html>