Tag-Identifier value for parallel logging
SMTP email proxy and relay server
Brought to you by:
graeme_walker
Hello,
when I try to use emailrelay in production environment with huge mail flows, really hard to analysis logs.
as you know it accept multiple mails at same time and log this one. but we lose our way when analyzing logs.
so, can you add any value for tracking logs for same message?
Would adding the incoming connection's port number to the "--log-address" string be sufficient? That's a one line change to src/gnet/gserverpeer.cpp : replace hostPartString() with displayString().
yeap, it would be okay.
I test it and it worked.
Okay, I'll leave this ticket open and give it some more thought before the next release.
I would appreciate it if you could add a review ( https://sourceforge.net/projects/emailrelay/reviews/ ) with more information on how you are using emailrelay (inc. o/s and mail volumes).
hi again Graeme,
can we add same details or another one for forwarded mails? in GSmtp::ClientProtocol lines.
The client side should be less of a problem to disentangle because there is usually only one client connection at a time. (There can be multiple client connections if you are forwarding via --admin or using --immediate or if you have more than one configuration.)
If you want to add client-side logging using the same mechanism as on the server side then I have attached a patch. It logs the local address including the port number, which should be unique enough for disentanglement because port numbers will not be reused immediately.
Or you could also just modify the G_LOG lines in src/gsmtp/gsmtpclientprotocol.cpp to log whatever you want. For example, to add the message id:
second one is good solution;
add m_message_state.id to log line
So I have now added a "--log-format" option that can be used to add additional fields to the log output, in addition to the existing "--log-address" option. In your case you would use "--log-format=address,port,msgid" to get the full TCP address on the server side and the current message-id on the client side.
The code is checked into SF svn trunk and SF git as version 2.5.3dev1. Please give it a go and let me know what you think.
optional and good feature.
thanks.
This is in v2.6 as "--log-format=time,address,port,unit,msgid".