1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
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.
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>
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_file_custom,log_file_path,log_limit,log_in,log_out,log_mark,log_events,log_wm,log_wmtype,log_wmip,log_wmdmax,log_wmsmax"); %>
27 function verifyFields(focused
, quiet
)
31 a
= E('_f_log_file').checked
;
32 b
= E('_f_log_remote').checked
;
33 c
= E('_f_log_file_custom').checked
;
36 E('_log_in').disabled
= a
;
37 E('_log_out').disabled
= a
;
38 E('_log_limit').disabled
= a
;
39 E('_log_mark').disabled
= a
;
40 E('_f_log_acre').disabled
= a
;
41 E('_f_log_crond').disabled
= a
;
42 E('_f_log_dhcpc').disabled
= a
;
43 E('_f_log_ntp').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 E('_f_log_file_custom').disabled
= !E('_f_log_file').checked
;
51 E('_log_file_path').disabled
= !c
|| !E('_f_log_file').checked
;
54 if (!v_range('_log_limit', quiet
, 0, 2400)) return 0;
55 if (!v_range('_log_mark', quiet
, 0, 99999)) return 0;
57 c
= E('_log_remoteip');
58 if (!v_ip(c
, 1) && !v_domain(c
, 1)) {
59 if (!quiet
) ferror
.show(c
);
62 if (!v_port('_log_remoteport', quiet
)) return 0;
66 a
= E('_f_log_wm').checked
;
67 b
= E('_log_wmtype').value
!= 0;
68 E('_log_wmtype').disabled
= !a
;
69 E('_f_log_wmip').disabled
= !a
;
70 E('_log_wmdmax').disabled
= !a
;
71 E('_log_wmsmax').disabled
= !a
;
72 elem
.display(PR('_f_log_wmip'), b
);
76 if (!_v_iptaddr('_f_log_wmip', quiet
, 15, 1, 1)) return 0;
78 if (!v_range('_log_wmdmax', quiet
, 0, 9999)) return 0;
79 if (!v_range('_log_wmsmax', quiet
, 0, 9999)) return 0;
89 if (!verifyFields(null, false)) return;
92 fom
.log_remote
.value
= E('_f_log_remote').checked
? 1 : 0;
93 fom
.log_file
.value
= E('_f_log_file').checked
? 1 : 0;
94 fom
.log_file_custom
.value
= E('_f_log_file_custom').checked
? 1 : 0;
97 if (E('_f_log_acre').checked
) a
.push('acre');
98 if (E('_f_log_crond').checked
) a
.push('crond');
99 if (E('_f_log_dhcpc').checked
) a
.push('dhcpc');
100 if (E('_f_log_ntp').checked
) a
.push('ntp');
101 if (E('_f_log_sched').checked
) a
.push('sched');
102 fom
.log_events
.value
= a
.join(',');
104 fom
.log_wm
.value
= E('_f_log_wm').checked
? 1 : 0;
105 fom
.log_wmip
.value
= fom
.f_log_wmip
.value
.split(/\s*,\s*/).join(',');
113 <form id='_fom' method='post' action='tomato.cgi'
>
114 <table id='container' cellspacing=
0>
115 <tr><td colspan=
2 id='header'
>
116 <div class='title'
>Tomato
</div>
117 <div class='version'
>Version <%
version(); %></div>
119 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
121 <div id='ident'
><%
ident(); %></div>
125 <input type='hidden' name='_nextpage' value='admin-log.asp'
>
126 <input type='hidden' name='_service' value='logging-restart'
>
128 <input type='hidden' name='log_remote'
>
129 <input type='hidden' name='log_file'
>
130 <input type='hidden' name='log_file_custom'
>
131 <input type='hidden' name='log_events'
>
133 <input type='hidden' name='log_wm'
>
134 <input type='hidden' name='log_wmip'
>
136 <script type='text/javascript'
>
139 <div class='section-title'
>Syslog
</div>
140 <div class='section'
>
141 <script type='text/javascript'
>
146 if (nvram.log_mark >= 120) nvram.log_mark = 120;
147 else if (nvram.log_mark >= 60) nvram.log_mark = 60;
148 else if (nvram.log_mark > 0) nvram.log_mark = 30;
149 else nvram.log_mark = 0;
152 createFieldTable('', [
153 { title
: 'Log Internally', name
: 'f_log_file', type
: 'checkbox', value
: nvram
.log_file
== 1 },
154 { title
: 'Custom Log File Path', multi
: [
155 { name
: 'f_log_file_custom', type
: 'checkbox', value
: nvram
.log_file_custom
== 1, suffix
: ' ' },
156 { name
: 'log_file_path', type
: 'text', maxlen
: 32, size
: 34, value
: nvram
.log_file_path
, suffix
: ' <br><small>(make sure the directory exists and is writable)</small>' }
158 { title
: 'Log To Remote System', name
: 'f_log_remote', type
: 'checkbox', value
: nvram
.log_remote
== 1 },
159 { title
: 'Host or IP Address / Port', indent
: 2, multi
: [
160 { name
: 'log_remoteip', type
: 'text', maxlen
: 15, size
: 17, value
: nvram
.log_remoteip
, suffix
: ':' },
161 { name
: 'log_remoteport', type
: 'text', maxlen
: 5, size
: 7, value
: nvram
.log_remoteport
} ]},
162 { title
: 'Generate Marker', name
: 'log_mark', type
: 'select', options
: [[0,'Disabled'],[30,'Every 30 Minutes'],[60,'Every 1 Hour'],[120,'Every 2 Hours'],[360,'Every 6 Hours'],[720,'Every 12 Hours'],[1440,'Every 1 Day'],[10080,'Every 7 Days']], value
: nvram
.log_mark
},
163 { title
: 'Events Logged', text
: '<small>(some of the changes will take effect after a restart)</small>' },
164 { title
: 'Access Restriction', indent
: 2, name
: 'f_log_acre', type
: 'checkbox', value
: (nvram
.log_events
.indexOf('acre') != -1) },
165 { title
: 'Cron', indent
: 2, name
: 'f_log_crond', type
: 'checkbox', value
: (nvram
.log_events
.indexOf('crond') != -1) },
166 { title
: 'DHCP Client', indent
: 2, name
: 'f_log_dhcpc', type
: 'checkbox', value
: (nvram
.log_events
.indexOf('dhcpc') != -1) },
167 { title
: 'NTP', indent
: 2, name
: 'f_log_ntp', type
: 'checkbox', value
: (nvram
.log_events
.indexOf('ntp') != -1) },
168 { title
: 'Scheduler', indent
: 2, name
: 'f_log_sched', type
: 'checkbox', value
: (nvram
.log_events
.indexOf('sched') != -1) },
169 { title
: 'Connection Logging' },
170 { 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
},
171 { 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
},
172 { title
: 'Limit', indent
: 2, name
: 'log_limit', type
: 'text', maxlen
: 4, size
: 5, value
: nvram
.log_limit
, suffix
: ' <br><small>(messages per minute / 0 for unlimited)</small>' }
177 <div class='section-title'
>Web Monitor
</div>
178 <div class='section'
>
179 <script type='text/javascript'
>
180 createFieldTable('', [
181 { title
: 'Monitor Web Usage', name
: 'f_log_wm', type
: 'checkbox', value
: nvram
.log_wm
== 1 },
182 { title
: 'Monitor', name
: 'log_wmtype', type
: 'select', options
: [[0,'All Computers / Devices'],[1,'The Following...'],[2,'All Except...']], value
: nvram
.log_wmtype
},
183 { title
: 'IP Address(es)', indent
: 2, name
: 'f_log_wmip', type
: 'text', maxlen
: 512, size
: 64, value
: nvram
.log_wmip
,
184 suffix
: '<br><small>(ex: "1.1.1.1", "1.1.1.0/24" or "1.1.1.1 - 2.2.2.2")</small>' },
185 { title
: 'Number of Entries to remember' },
186 { title
: 'Domains', indent
: 2, name
: 'log_wmdmax', type
: 'text', maxlen
: 4, size
: 6, value
: nvram
.log_wmdmax
, suffix
: ' <small>(0 to disable)</small>' },
187 { title
: 'Searches', indent
: 2, name
: 'log_wmsmax', type
: 'text', maxlen
: 4, size
: 6, value
: nvram
.log_wmsmax
, suffix
: ' <small>(0 to disable)</small>' }
195 <tr><td id='footer' colspan=
2>
196 <span id='footer-msg'
></span>
197 <input type='button' value='Save' id='save-button' onclick='save()'
>
198 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'
>
202 <script type='text/javascript'
>verifyFields(null, 1);</script>