On the road again

Exilog - инструмент который позволяет красиво визуализировать, просматривать по всевозможным фильтрам логи Exim через веб-интерфейс. Использует mysql ( postgresql при желании).Написан на perl.

Итак, ствим Exilog из портов, предварительно обновив их.

cd /usr/ports/mail/exilog
make

make install

make clean

rehash

Для Apache необходим mod_cgi !

Создаем базу данных, пользователя и даем ему права на созданную БД.
mysql -u root -p
password:******
CREATE DATABASE exilog \
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON exilog.* TO \
exilog@localhost IDENTIFIED BY 'exilog';
use exilog;
GRANT ALL PRIVILEGES ON *.* TO exilog@localhost \
IDENTIFIED BY 'exilog' WITH GRANT OPTION;
\q

Импортируем дамп таблиц в созданную БД. Дамп находится по адресу /usr/local/share/doc/exilog/mysql-db-script.sql
mysql -u root -p *********  \
-D exilog </usr/local/share/doc/exilog/mysql-db-script.sql

\q
Данную операцию также можно произвести средствами phpmyadmin.

Далее приступаем к правке конфигурационного файла /usr/local/etc/exilog.conf

{ # DO NOT REMOVE THIS BRACKET

# Exilog config file. Read the comments. Obey the syntax.
# (c) Tom Kistner 2005


'servers' => { # ------------------------------------
# Server definitions. One block per server,
# separated with comma.

# Currently, each server only has a single
# property: Its group membership. Groups are
# just strings that bundle servers. Each
# server can only be in one group.

# Keep the server names short (do not use FQDN).
# Likewise, keep the group names short.

'MyCompany' => {
'group' => 'MyServer'

},

#      'fanucci' => {
#                     'group' => 'MXes'
#                   }

}, # End of server definitions ----------------------


'sql' => { # ----------------------------------------
# SQL Server definition. Use one of the following
# blocks as a template.

# Example for local MySQL server
'type'     => 'mysql',
'DBI'      => 'DBI:mysql:database=exilog;',
'user'     => 'exilog',
'pass'     => 'exilog'


# Example for remote MySQL server
#'type'     => 'mysql',
#'DBI'      => 'DBI:mysql:database=exilog;host=localhost;port=3306',
#'user'     => 'exilog',
#'pass'     => 'exilog'

# Example for Postgresql server
#'type'     => 'pgsql',
#'DBI'      => 'DBI:Pg:dbname=exilog;host=195.2.162.40;port=5432;',
#'user'     => 'myuser',
#'pass'     => 'mypass'

}, # End of SQL server definition --------------------


'agent' => { # ---------------------------------------
# Agent configuration.

# The agent writes a log file. You can also
# use /dev/null here once things are running
# smoothly.
'log' => '/var/log/exilog_agent',

# The agent writes its PID into this file. Useful,
# if you want to start the agent using a command
# like start-stop-daemon.
'pidfile' => '/var/run/exilog-agent.pid',

# If this is set to 'no', the agent will NOT change
# its process names to be more informative. This will
# prevent problems on systems that restrict changes
# to process names for security reasons (Debian and
# NetBSD for example).
'use_pretty_names' => 'yes',

# The server the agent is running on. MUST
# be one of the names specified in the
# 'Servers' section above.
'server' => 'MyCompany',

# The log(s) to monitor. If you log via syslog,
# this will only be a single file (typically
# /var/log/mail). If you use Exim's own logging,
# you should specify the mainlog and rejectlog here.
'logs' => [
'/var/log/exim/mainlog'
],


# Path to Exim's queue directory.
'queue' => '/var/spool/exim',

# Path to your Exim binary
'exim' => '/usr/sbin/exim',

# Delay between two queue listing refreshes.
# Thirty seconds is reasonable.
'queue_refresh_delay' => 30

}, # End of Exilog Agent configuration ---------------


'cleanup' => { # -------------------------------------
# Configuration for the database cleanup tool
# (exilog_cleanup.pl).

# How many days worth of logs to keep in the
# database. 10 days is somehow reasonable. If
# you run a small shop you can also keep months
# of logs. If you run a VERY big shop you might
# want to reduce this number or buy some more
# processing power.
'cutoff' => 100

}, # End of exilog_cleanup.pl configuration ----------


'web' => { # -----------------------------------------
# Options for the web interface.

# Defines how the web interface shows timestamps.
# Use 'local' to use the local time of the HTTP server
# machine, or use 'gmt' to use normalized GMT
# timestamps.
# TIP: If all of your machines are in one time zone,
# use 'local'.
'timestamps' => 'local',

# When using basic auth to restrict access to the web
# interface, you can define users to be "read-only".
# They will not be able to cancel or delete messages
# (but they can start a delivery run). Clients that
# do not authenticate are mapped to a user name
# of "anonymous".
'restricted_users' => [
'anonymous',
'bob',
'alice',
'peter'
]


} # End of web interface configuration ---------------
};

 

Запуск демона

/usr/local/etc/rc.d/exilog start

Добавляем в автозагрузку

echo "exilog_enable="YES"" >> /etc/rc.conf

Добавляем виртуальный хост в Apache

<VirtualHost *:80>
ServerAdmin Ця електронна адреса захищена від спам-ботів. Вам необхідно увімкнути JavaScript, щоб побачити її.
DocumentRoot /usr/local/www/exilog
ServerName mail.company.com
DirectoryIndex exilog_cgi.pl
ErrorLog /usr/local/www/exilog/logs/exilog.log
<Directory "/usr/local/www/exilog/">
Options ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

 

На этом все, заходим на mail.company.com и любуемся веб-интерфейсом.

 

Add comment