[GH-ISSUE #266] Stats extensions does not create rrd files #252

Closed
opened 2026-02-27 11:10:48 +03:00 by kerem · 5 comments
Owner

Originally created by @tonioo on GitHub (Dec 4, 2013).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/266

Originally assigned to: @tonioo on GitHub.

Originally created by Reza Muhammad on 2012-06-08T18:46:45Z

Hello,

I have just recently come across this project and I have to say I love it alot :) However, there are some things I found that do not work as expected. So I'll start with this one.

I tried to enable the stats extension from the admin preference, and tried to run the logparser.py. However, there are no files created inside /tmp/modoboa or <modoboa_dir>/static/graphs.
I looked over the source code at <modoboa_dir>/extensions/stats/scripts/logparser.py and noticed that there might be a problem with self.line_expr regex pattern.

On line 185 (changeset 719/cd1c253a9da9), "m = self.line_expr.match(line)" never returns anything. So I wonder whether my Postfix log is in a different format than what was expected?

i'm running Postfix 2.9.1.

Btw, here's some of the logs from my /var/log/mail.log:

Jun  9 00:26:01 modoboa-test postfix/smtpd[1896]: connect from localhost[127.0.0.1]Jun  9 00:26:01 modoboa-test postfix/smtpd[1896]: Anonymous TLS connection established fro
m localhost[127.0.0.1]: TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)
Jun  9 00:26:02 modoboa-test postfix/smtpd[1896]: F3D3530C4: client=localhost[127.0.0.1], sasl_method=PLAIN, sasl_username=user@mydom.com
Jun  9 00:26:02 modoboa-test postfix/cleanup[1905]: F3D3530C4: message-id=<20120608172601.1853.5046@modoboa-test>
Jun  9 00:26:02 modoboa-test postfix/qmgr[1238]: F3D3530C4: from=, size=723, nrcpt=1 (queue active)
Jun  9 00:26:02 modoboa-test postfix/smtpd[1896]: disconnect from localhost[127.0.0.1]Jun  9 00:26:02 modoboa-test dovecot: lda(rezmuh@mydom.com): sieve: msgid=<20120608172601.
1853.5046@modoboa-test>: stored mail into mailbox 'Junk'Jun  9 00:26:02 modoboa-test postfix/pipe[1910]: F3D3530C4: to=, relay=d
spam, delay=0.86, delays=0.21/0.04/0/0.6, dsn=2.0.0, status=sent (delivered via dspam service)
Jun  9 00:26:02 modoboa-test postfix/qmgr[1238]: F3D3530C4: removed

And my stats extension settings:

LOGFILE = /var/log/mail.log
RRD_ROOTDIR = /tmp/modoboa
IMG_ROOT_DIR = /home/rezmuh/sites/modoboa/src/modoboa/static/graphs

The command I used to run logparser.py:

$ pwd
/home/rezmuh/sites/modoboa/src/modoboa
 PYTHONPATH=$PWD/.. DJANGO_SETTINGS_MODULE=modoboa.settings extensions/stats/scripts/logparser.py --verbose --debug
[rrd] Dealing with year 2012
[rrd] dealing with domain global
[rrd] dealing with domain mydom.com

So can anyone help me out on this? or is it truly a bug?
Thanks.

Originally created by @tonioo on GitHub (Dec 4, 2013). Original GitHub issue: https://github.com/modoboa/modoboa/issues/266 Originally assigned to: @tonioo on GitHub. **Originally created by Reza Muhammad on 2012-06-08T18:46:45Z** Hello, I have just recently come across this project and I have to say I love it alot :) However, there are some things I found that do not work as expected. So I'll start with this one. I tried to enable the stats extension from the admin preference, and tried to run the logparser.py. However, there are no files created inside /tmp/modoboa or <modoboa_dir>/static/graphs. I looked over the source code at <modoboa_dir>/extensions/stats/scripts/logparser.py and noticed that there might be a problem with self.line_expr regex pattern. On line 185 (changeset 719/cd1c253a9da9), "m = self.line_expr.match(line)" never returns anything. So I wonder whether my Postfix log is in a different format than what was expected? i'm running Postfix 2.9.1. Btw, here's some of the logs from my /var/log/mail.log: <pre> Jun 9 00:26:01 modoboa-test postfix/smtpd[1896]: connect from localhost[127.0.0.1]Jun 9 00:26:01 modoboa-test postfix/smtpd[1896]: Anonymous TLS connection established fro m localhost[127.0.0.1]: TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits) Jun 9 00:26:02 modoboa-test postfix/smtpd[1896]: F3D3530C4: client=localhost[127.0.0.1], sasl_method=PLAIN, sasl_username=user@mydom.com Jun 9 00:26:02 modoboa-test postfix/cleanup[1905]: F3D3530C4: message-id=<20120608172601.1853.5046@modoboa-test> Jun 9 00:26:02 modoboa-test postfix/qmgr[1238]: F3D3530C4: from=<user@mydom.com>, size=723, nrcpt=1 (queue active) Jun 9 00:26:02 modoboa-test postfix/smtpd[1896]: disconnect from localhost[127.0.0.1]Jun 9 00:26:02 modoboa-test dovecot: lda(rezmuh@mydom.com): sieve: msgid=<20120608172601. 1853.5046@modoboa-test>: stored mail into mailbox 'Junk'Jun 9 00:26:02 modoboa-test postfix/pipe[1910]: F3D3530C4: to=<rezmuh@mydom.com>, relay=d spam, delay=0.86, delays=0.21/0.04/0/0.6, dsn=2.0.0, status=sent (delivered via dspam service) Jun 9 00:26:02 modoboa-test postfix/qmgr[1238]: F3D3530C4: removed </pre> And my stats extension settings: <pre> LOGFILE = /var/log/mail.log RRD_ROOTDIR = /tmp/modoboa IMG_ROOT_DIR = /home/rezmuh/sites/modoboa/src/modoboa/static/graphs </pre> The command I used to run logparser.py: <pre> $ pwd /home/rezmuh/sites/modoboa/src/modoboa PYTHONPATH=$PWD/.. DJANGO_SETTINGS_MODULE=modoboa.settings extensions/stats/scripts/logparser.py --verbose --debug [rrd] Dealing with year 2012 [rrd] dealing with domain global [rrd] dealing with domain mydom.com </pre> So can anyone help me out on this? or is it truly a bug? Thanks.
kerem 2026-02-27 11:10:48 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-06-08T19:55:21Z

Thanks for your feedback.

I think you've found a real bug. Looking at the regexp you're talking about, I think the problem comes from the hostname (modoboa-test). It doesn't consider the '-' character as an allowed one.

Can you try to remove the '-' from the hostname and tell me if it works ?

<!-- gh-comment-id:29815245 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-06-08T19:55:21Z** Thanks for your feedback. I think you've found a real bug. Looking at the regexp you're talking about, I think the problem comes from the hostname (modoboa-test). It doesn't consider the '-' character as an allowed one. Can you try to remove the '-' from the hostname and tell me if it works ?
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Reza Muhammad on 2012-06-09T08:34:02Z

Hello Antoine,

Yes after changing the hostname without dashes, the parser works fine. I've also renamed my hostname back into using a dash and created a patch so it can support dashes in the hostname.

Reza.

<!-- gh-comment-id:29815247 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Reza Muhammad on 2012-06-09T08:34:02Z** Hello Antoine, Yes after changing the hostname without dashes, the parser works fine. I've also renamed my hostname back into using a dash and created a patch so it can support dashes in the hostname. Reza.
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Reza Muhammad on 2012-06-09T08:41:24Z

Another thing, while the logparser.py worked with the above patch, the images still wouldn't show up. I looked around the template and it seemed that the template was looking for the images in {{ MEDIA_URL }}/stats/ while the doc mentioned to put it in MODOBOA_DIR/static/graphs.

So what I did was:

  • Changed the MEDIA_ROOT to MODOBOA_DIR/static/
  • Updated the template in graphs.html (line 7) to look for images in {{ MEDIA_URL }}/graphs/ instead of {{ MEDIA_URL }}/stats/
  • Updated urls.py to look for static (using django's static-files) as well as serving media files when settings.DEBUG = True

I've also created a diff for these changes but am not sure if they are the correct way of doing it. The diff was created against changeset: 31a51350175d.

<!-- gh-comment-id:29815248 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Reza Muhammad on 2012-06-09T08:41:24Z** Another thing, while the logparser.py worked with the above patch, the images still wouldn't show up. I looked around the template and it seemed that the template was looking for the images in {{ MEDIA_URL }}/stats/ while the doc mentioned to put it in MODOBOA_DIR/static/graphs. So what I did was: - Changed the MEDIA_ROOT to MODOBOA_DIR/static/ - Updated the template in graphs.html (line 7) to look for images in {{ MEDIA_URL }}/graphs/ instead of {{ MEDIA_URL }}/stats/ - Updated urls.py to look for static (using django's static-files) as well as serving media files when settings.DEBUG = True I've also created a diff for these changes but am not sure if they are the correct way of doing it. The diff was created against changeset: 31a51350175d.
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-06-09T08:45:45Z

Thanks Reza,

I'll apply your first patch soon and this issue will be fixed for 0.9.1.

The second issue just concerns documentation, I forgot to update this part.

<!-- gh-comment-id:29815250 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-06-09T08:45:45Z** Thanks Reza, I'll apply your first patch soon and this issue will be fixed for 0.9.1. The second issue just concerns documentation, I forgot to update this part.
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2012-06-09T09:04:30Z

Applied in changeset commit:1df4b84b8db8.

<!-- gh-comment-id:29815253 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2012-06-09T09:04:30Z** Applied in changeset commit:1df4b84b8db8.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#252
No description provided.