Coder Social home page Coder Social logo

Comments (8)

strycore avatar strycore commented on August 14, 2024

HI @stiadmin
I haven't used this script since 2010, could you possibly submit a pull request to fix this issue? I'll look into it.

from scripts.

vivek779 avatar vivek779 commented on August 14, 2024

I also use this script bt it is showing errors i have edited path in script like
postfix_log = os.path.join(log_prefix, 'mail.info.0'
to
postfix_log = os.path.join(log_prefix, 'maillog'
My postfix logs which are at /var/log/mailog
and
MYSQL_USER = 'mailing'
MYSQL_PASSWORD = 'mailinga2v'
MYSQL_DATABASE = MYSQL_USER
MYSQL_HOST = 'localhost'
MYSQL_TABLE = 'mail_tracking'
to
MYSQL_USER = 'root'
MYSQL_PASSWORD = 'vivek'
MYSQL_DATABASE = logs
MYSQL_HOST = 'localhost'
MYSQL_TABLE = 'mail_tracking'
these are mysql credentials
please guide me to run this scripts

from scripts.

strycore avatar strycore commented on August 14, 2024

Like I said before, I haven't used this script in 5 years. What errors are you getting?

from scripts.

vivek779 avatar vivek779 commented on August 14, 2024

When i use script it show erros like this
File "./postfix-log.py", line 177, in
mailinfo[queue_id]['message_id'])
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, "Table 'logs.mail_tracking' doesn't exist")
So i created mail_tracking table with field manetioned at starting of script then it shows errors like this
File "./postfix-log.py", line 177, in
mailinfo[queue_id]['message_id'])
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, "Table 'logs.mail_tracking' doesn't exist")

from scripts.

strycore avatar strycore commented on August 14, 2024

Well the error message is pretty explicit. You have to create the mail_tracking table. There's a mysql command in the command at the beginning of the script that does that, just make sure to change the table name which is postfix_log in the comment but mail_tracking in the rest of the script.

from scripts.

vivek779 avatar vivek779 commented on August 14, 2024

Thanks for revert
I followed your steps and created a different database name postfix and created a table like this mail_tracking and changed log prefix like this
postfix_log = os.path.join(log_prefix, 'maillog')
It is showing error as follows
Traceback (most recent call last):
File "postfix-logparser.py", line 89, in
event_date = str(datetime.datetime.strptime(event_date_str, "%Y %b %j %H:%M:%S"))
File "/usr/lib64/python2.6/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '2015 Tue Nov 17' does not match format '%Y %b %j %H:%M:%S'

please help me in this also how to solve this and run the script

from scripts.

farfar56 avatar farfar56 commented on August 14, 2024

Dear strycore
when running, i get the following error

Traceback (most recent call last):
File "postfix-logparser.py", line 118, in
(email_from, size, nrcpt) = details.split(',',3)
ValueError: too many values to unpack

In addition, my postfix version is 2.11
Please help me to solve this problem .

from scripts.

strycore avatar strycore commented on August 14, 2024

Hi farfar56

I wrote this script for a one time use only for a job I had 6 years ago. I do not plan to use it anymore or to spend more time on it. I left it here in case people who are able to maintain it themselves would want to use it but the script itself is very poorly written (I had 1 year of experience with Python at the time).

I'm sure there are tools better written and currently maintained that to do the same thing (or, at least, I hope there are, this wasn't the case 6 years ago). I'll now be retiring this script and remove it from the repo. Anyone who wishes to take maintainership can do so by forking the project.

from scripts.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.