lma version 1.2.1
=================

Congratulations for downloading LMA!

LMA is a mail server (postfix, sendmail) log analyzer.

INSTALLATION

To install this module type the following:

   tar -xzvf lma.tar.gz
   cd lma
   perl Makefile.PL
   make
   make install

Note: you have to be root.
Note: sometimes Makefile is not created after the command "perl Makefile.PL". Giving this command another time will solve the problem.


DEPENDENCIES

This module requires these other modules and libraries:

  - Time::JulianDay
  - Date::Parse
  - DB_File
  - Getopt::Long
  - DBD::mysql
  - DBI::DBD

During the installation the system will ask you if you want to install them through CPAN.

If you don't wanto to use mysql database you can type:
    perl Makefile.PL --without-mysql
In this case the system won't check if DBD::mysql library is present in your system.




RUNNING THE PROGRAM


Choose a database between berkeley and mysql (editing /etc/lma/conf.txt).
Depending on what you chose here are the options available:

-------------Berkeley case-----------------

1)Feed your log files into program:

ls /var/spool/logs/* | lma.pl --rebuild 2005

Explanation:
--rebuild: Use this flag if you want to rebuild your database (only in berkeley DB case)
2005: Year of the logs (in mail logs year is not indicated)
The program create lma_output.txt.

2) Feed your log files into program:

ls /var/spool/logs/* | lma.pl -o info 2005

Explanation:
info: the program doesn't create lma_output.txt, but a file named info (you can choose another name!)

3) 

lma.pl -d /var/spool/logs/ 2005

Explanation:
This option is equivalent to "ls /var/spool/logs/* | lma.pl 2005"
Path has to be absolute.

4)Feed your log files into program:

ls /var/spool/logs/* | lma.pl -v 2005

Explanation: 
-v:a lot of print!! ;-)

-------------Mysql case-----------------

All options are available, but before running LMA you need to create a database on your pc with the following command:

CREATE TABLE `maildb` (
  `id` int(11) NOT NULL auto_increment,
  `timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
  `nomeclient` varchar(50) default NULL,
  `ipclient` varchar(30) NOT NULL default '',
  `ipserver` varchar(30) NOT NULL default '',
  `fromfield` varchar(60) default NULL,
  `tofield` varchar(60) default NULL,
  `status` varchar(10) default NULL,
  `size` varchar(20) default NULL,
  PRIMARY KEY  (`id`),
  KEY `timestamp` (`timestamp`,`nomeclient`,`ipclient`)
);

Remember to edit MySQL options in /etc/lma/conf.txt (host, database,user,password).

OTHERS UTILITIES

- queryDB.pl (allows you to make various queries on Berkeley DB files)


- TStamp.pl (utility to convert timestamp in date format and viceversa)

- stampaDB.pl (useful to print the data inside databases)
  Note: date_DB and mail_DB are btrees (-b flag)
        the other ones are hashes (-h flag)
  

COPYRIGHT AND LICENCE

Copyright (C) 2005 Maurizio Aiello <maurizio.aiello@ieiit.cnr.it>

                          http://lma.sourceforge.net/

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


