5 require './syslog-lib.pl';
6 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
7 &help_search_link("syslog", "man", "doc"));
9 if ($config{'m4_conf'}) {
10 # Does the config file need to be passed through m4?
12 # syslog.conf has m4 directives .. ask the user if he wants
14 print "<p>",&text('index_m4msg',
15 "<tt>$config{'syslog_conf'}</tt>"),"\n";
16 print "<center><form action=m4.cgi>\n";
17 print "<input type=submit value='$text{'index_m4'}'>\n";
18 print "</form></center>\n";
19 &ui_print_footer("/", $text{'index'});
24 if (!-r $config{'syslog_conf'}) {
25 # Not installed (maybe using syslog-ng)
26 &ui_print_endpage(&text('index_econf', "<tt>$config{'syslog_conf'}</tt>", "../config.cgi?$module_name"));
29 # Display syslog rules
31 if ($access{'syslog'}) {
32 $conf = &get_config();
33 push(@links, "<a href='edit_log.cgi?new=1'>$text{'index_add'}</a>")
34 if (!$access{'noedit'});
36 print &ui_links_row(\@links);
37 print &ui_columns_start([
39 $config{'tags'} ? ( $text{'index_tag'} ) : ( ),
40 $text{'index_active'},
41 $text{'index_rule'}, "" ], 100);
42 if ($access{'syslog'}) {
44 next if ($c->{'tag'});
45 next if (!&can_edit_log($c));
49 $name = &text('index_file',
50 "<tt>".&html_escape($c->{'file'})."</tt>");
52 elsif ($c->{'pipe'} && $config{'pipe'} == 1) {
53 $name = &text('index_pipe',
54 "<tt>".&html_escape($c->{'pipe'})."</tt>");
56 elsif ($c->{'pipe'} && $config{'pipe'} == 2) {
57 $name = &text('index_pipe2',
58 "<tt>".&html_escape($c->{'pipe'})."</tt>");
60 elsif ($c->{'host'}) {
61 $name = &text('index_host',
62 "<tt>".&html_escape($c->{'host'})."</tt>");
64 elsif ($c->{'socket'}) {
65 $name = &text('index_socket',
66 "<tt>".&html_escape($c->{'socket'})."</tt>");
69 $name = $text{'index_all'};
72 $name = &text('index_users',
73 "<tt>".join(" ", map { &html_escape($_) }
74 @{$c->{'users'}})."</tt>");
76 if ($access{'noedit'}) {
80 push(@cols, "<a href='edit_log.cgi?".
81 "idx=$c->{'index'}'>$name</a>");
83 if ($config{'tags'}) {
84 push(@cols, $c->{'section'}->{'tag'} eq '*' ?
85 $text{'all'} : $c->{'section'}->{'tag'});
87 push(@cols, $c->{'active'} ? $text{'yes'} :
88 "<font color=#ff0000>$text{'no'}</font>");
89 push(@cols, join(" ; ",
90 map { &html_escape($_) } @{$c->{'sel'}}));
91 if ($c->{'file'} && -f $c->{'file'}) {
92 push(@cols, "<a href='save_log.cgi?idx=$c->{'index'}&".
93 "view=1'>$text{'index_view'}</a>\n");
98 print &ui_columns_row(\@cols);
102 # Display logs from other modules
103 if ($config{'others'} && $access{'others'}) {
104 @others = &get_other_module_logs();
107 $cols = $config{'tags'} ? 5 : 4;
108 foreach $o (@others) {
109 next if (!&can_edit_log($o));
112 push(@cols, &text('index_file',$o->{'file'}));
115 push(@cols, &text('index_cmd',$o->{'cmd'}));
117 if ($config{'tags'}) {
120 push(@cols, $o->{'active'} ? $text{'yes'} :
121 "<font color=#ff0000>$text{'no'}</font>");
122 push(@cols, $o->{'desc'});
123 push(@cols, "<a href='save_log.cgi?oidx=$o->{'mindex'}".
124 "&omod=$o->{'mod'}&view=1'>$text{'index_view'}</a>");
125 print &ui_columns_row(\@cols);
129 # Display extra log files
130 foreach $e (&extra_log_files()) {
131 next if (!&can_edit_log($e));
133 push(@cols, &text('index_file', $e->{'file'}));
134 if ($config{'tags'}) {
137 push(@cols, $text{'yes'});
138 push(@cols, $e->{'desc'});
139 push(@cols, "<a href='save_log.cgi?extra=$e->{'file'}&view=1'>".
140 "$text{'index_view'}</a>");
141 print &ui_columns_row(\@cols);
144 print &ui_columns_end();
145 print &ui_links_row(\@links);
148 if ($access{'any'}) {
149 # Can view any log (under allowed dirs)
150 print &ui_form_start("save_log.cgi");
151 print &ui_hidden("view", 1),"\n";
152 print "<b>$text{'index_viewfile'}</b>\n",
153 &ui_textbox("file", undef, 50),"\n",
154 &file_chooser_button("file", 0, 1),"\n",
155 &ui_submit($text{'index_viewok'}),"\n";
156 print &ui_form_end();
159 # Buttons to restart/start syslogd
160 if (!$access{'noedit'}) {
162 $pid = &get_syslog_pid();
163 print &ui_buttons_start();
165 print &ui_buttons_row("restart.cgi",
166 $text{'index_restart'},
167 $text{'index_restartmsg'});
170 print &ui_buttons_row("start.cgi",
171 $text{'index_start'},
172 &text('index_startmsg',
173 "<tt>$config{'syslogd'}</tt>"));
175 print &ui_buttons_end();
178 &ui_print_footer("/", $text{'index'});