Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMS-177 #32

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ module.exports.init = function (app, done) {
const gridfsdb = app.db.gridfs;

const component = ((app.config.gelf && app.config.gelf.component) || 'mta').toUpperCase();

const maxSubjectLineLogLengthBytes = app.config.gelf.subjectLength || 32766 - 1; // 32766 is max gelf default, do -1 for good measure

const hostname = app.config.hostname || os.hostname();
const gelf =
app.config.gelf && app.config.gelf.enabled
Expand Down Expand Up @@ -1077,7 +1080,10 @@ module.exports.init = function (app, done) {
message._spam_score = Number(entry.score) || '';
message._interface = entry.interface;
message._proto = entry.transtype;
message._subject = entry.subject;
message._subject =
Buffer.byteLength(entry.subject, 'utf8') > maxSubjectLineLogLengthBytes
? entry.subject.substring(0, maxSubjectLineLogLengthBytes / 4) // divide by 4 to account for max utf-8 char size
: entry.subject;

message._authenticated_sender = username;
}
Expand Down
Loading