Skip to content

Commit b805d68

Browse files
authored
v.1.6 update
some new gui features and bugfixes
1 parent 5380a94 commit b805d68

File tree

19 files changed

+568
-101
lines changed

19 files changed

+568
-101
lines changed

CHANGES.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,30 @@ Unreleased VER.
66
- remove python privex helpers code (?)
77
- save settings into cookies (for firefox private window mainly) + accept cookies modal (?)
88
- fix dropdown update if use fomantic ui div based dropdown
9-
- add not (!) to text filters
109
- fix sort icon to the same shevrons as main menu gui show/hide buttons
1110
- upgrade procedure from GUI (?) if decided to do so use [this manual](https://stackoverflow.com/questions/32163955/how-to-run-shell-script-on-host-from-docker-container/63719458#63719458)
11+
- optimize and fix mail_to and log_lines queries with not(!)
12+
- BUG: fix process of '...and more' in stats
13+
- [fix of non-dockerizeed deploy issue](https://github.com/drlight17/mta-log-parser/issues/10)
14+
15+
16+
VER. 1.6
17+
- ~~use more then one CPU core when parsing (moment timestamp convert of related logs is variable)~~
18+
- ~~add ability to exclude some addresses from the TOP charts (frontend gui cookies + backend permanent using settings)~~
19+
- ~~add stats cached text background for better readability~~
20+
- ~~show all currently excluded in gui (backend in tips, frontend in gui)~~
21+
- ~~BUG: currently excluded unknown list fix~~
22+
- ~~BUG: fix currently excluded context menu (right click) doesn't appear in mobile view~~
23+
- ~~clear all currently excluded from cookies button~~
24+
- ~~BUG: exclude unknown~~
25+
- ~~add not (!) to text filters~~
26+
- ~~BUG: fix not(!) appearance in mobile mode~~
27+
- ~~BUGs with all stats after not(!) were added~~
28+
- ~~process sharelink, save and restore not (!) parameter value and from link~~
29+
- ~~BUG: stats_app is not defined~~
30+
- ~~fix "invalid data" in cached stats after cookie clear (replace with error text or copy last date to browser localstorage to use it in this case)~~
31+
- ~~[security fix](https://github.com/drlight17/mta-log-parser/security/dependabot/1)~~
32+
- ~~closed graphs and settings/tips by default~~
1233

1334
VER. 1.5.5
1435
- ~~BUG: auto turn on "save filters" on every link come even without paramaters~~

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
FROM python:3.8-alpine
33
RUN apk update
44
RUN apk add bash ncurses musl-dev gcc flock openldap-dev
5+
# upgrade pip
6+
RUN pip install --upgrade pip
57
RUN pip3 install -U pipenv
68
WORKDIR /app
79
COPY Pipfile /app/
810
# uncomment to append ypur ca cert for TLS connections i.e. LDAPS
911
#COPY ca.crt /usr/local/share/ca-certificates/ca.crt
1012
#RUN cat /usr/local/share/ca-certificates/ca.crt >> /etc/ssl/certs/ca-certificates.crt
11-
RUN pipenv install
13+
RUN pipenv install

Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ python-dateutil = "*"
1212
pytz = "*"
1313
rethinkdb = ">=2.4.7"
1414
python-dotenv = "*"
15-
quart = "=0.18.4"
16-
werkzeug = "=2.3.7"
15+
quart = "=0.19.4"
16+
werkzeug = "=3.0.1"
1717
moment = "*"
1818
datefinder = "*"
1919
python-ldap = "*"

build/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
FROM python:3.8-alpine
33
RUN apk update
44
RUN apk add bash ncurses musl-dev gcc flock openldap-dev
5+
# upgrade pip
6+
RUN pip install --upgrade pip
57
RUN pip3 install -U pipenv
68
WORKDIR /app
79
COPY . /app/

build/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ networks:
3737
driver: bridge
3838
driver_opts:
3939
com.docker.network.enable_ipv6: "false"
40-
com.docker.network.bridge.name: mlp_iface
40+
com.docker.network.bridge.name: mlp_iface

deploy/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Dockerfile for deploy
2+
FROM python:3.8-alpine
3+
RUN apk update
4+
RUN apk add bash ncurses musl-dev gcc flock openldap-dev
5+
# upgrade pip
6+
RUN pip install --upgrade pip
7+
RUN pip3 install -U pipenv
8+
WORKDIR /app
9+
COPY Pipfile /app/
10+
# uncomment to append ypur ca cert for TLS connections i.e. LDAPS
11+
#COPY ca.crt /usr/local/share/ca-certificates/ca.crt
12+
#RUN cat /usr/local/share/ca-certificates/ca.crt >> /etc/ssl/certs/ca-certificates.crt
13+
RUN pipenv install

deploy/docker-compose.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# compose file for deploy
2+
version: '3.9'
3+
4+
services:
5+
mlp:
6+
image: drlight17/mta-log-parser:latest
7+
container_name: mta-log-parser
8+
command: /app/run.sh ${COMMAND}
9+
ports:
10+
- ${PORT}:${PORT}
11+
restart: always
12+
volumes:
13+
- ./.env:/app/.env
14+
- /tmp:/tmp
15+
- ${MAIL_LOG_PATH}:${MAIL_LOG_PATH}
16+
depends_on:
17+
- rethinkdb
18+
networks:
19+
- internal
20+
21+
rethinkdb:
22+
image: rethinkdb:2.4
23+
container_name: rethinkdb
24+
ports:
25+
- ${RETHINK_EXP_GUI_PORT}:8080
26+
restart: always
27+
volumes:
28+
- ./:/data
29+
networks:
30+
- internal
31+
32+
networks:
33+
internal:
34+
driver: bridge
35+
driver_opts:
36+
com.docker.network.enable_ipv6: "false"
37+
com.docker.network.bridge.name: mlp_iface

example.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,18 @@ PORT=8487
4141
# make date time format (default is "HH:mm:ss, DD.MM.YYYY") to use in GUI for emails list timestamps and date picker according to moment.js templates (https://momentjs.com/)
4242
#DATETIME_FORMAT='HH:mm:ss, DD.MM.YYYY'
4343

44+
# convert related logs timestamp according to the DATETIME_FORMAT. High CPU demanding! false by default
45+
#MAIL_LOG_TIMESTAMP_CONVERT=false
46+
4447
# set MTA which logs you waunt to parse; available values are exim, postfix (default), sendmail and exchange
4548
#MTA=postfix
4649

50+
# set email addresses to exclude from top senders stats permanently (comma separated)
51+
#EXCLUDE_FROM_TOP_SENDERS='user1@example.com,user2@example.org'
52+
53+
# set email addresses to exclude from top recipients stats permanently (comma separated)
54+
#EXCLUDE_FROM_TOP_RECIPIENTS='user1@example.com,user2@example.org'
55+
4756
# set startup command
4857
# dev to run in python developer mode
4958
# prod to run in production mode (default)

mlp/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# !!! change version upon update !!!
4040
global VERSION
41-
VERSION ="1.5.5"
41+
VERSION ="1.6"
4242

4343
# postf_match += r'([A-F0-9]{11})\:[ \t]+?(.*)'
4444
#postf_match = r'([A-Za-z]+[ \t]+[0-9]+[ \t]+[0-9]+\:[0-9]+:[0-9]+).*'

mlp/objects.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
from mlp.settings import log_timezone
1111
from mlp import settings, api
1212

13+
import logging
14+
log = logging.getLogger(__name__)
15+
1316
@dataclass
1417
class PostfixLog(Dictable):
1518
timestamp: datetime
@@ -32,14 +35,19 @@ def __str__(self):
3235

3336
def clean_dict(self, convert_time=str) -> dict:
3437
data = dict(self)
35-
# log lines timestamp convert before append
36-
data['timestamp'] = moment.date(str(self.timestamp)).format(settings.datetime_format)
38+
# log lines timestamp convert before append (for message related log view)
39+
# this data conversion uses only one thread and takes too long so do it according to mail_log_timestamp_convert variable value
40+
# log.info('Converting date and time %s using moment library according to settings', data['timestamp'])
41+
if settings.mail_log_timestamp_convert:
42+
data['timestamp'] = moment.date(str(self.timestamp)).format(settings.datetime_format)
43+
else:
3744
#print(data)
3845

39-
'''if is_false(convert_time):
40-
data['timestamp'] = self.timestamp
41-
else:
42-
data['timestamp'] = convert_time(self.timestamp)'''
46+
if is_false(convert_time):
47+
data['timestamp'] = self.timestamp
48+
else:
49+
data['timestamp'] = convert_time(self.timestamp)
50+
4351
return data
4452

4553

0 commit comments

Comments
 (0)