[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Best practice to allow a program to write its logs



Hello,

Thanks for your answer :)

23 févr. 2020 à 18:02 de recoverym4n@enotuniq.net:

> Clever, but not any filesystem supports ACL.
> And you would have created a problem by your own hands if you're doing
> backups (depends on a type of a backup, of course).
>
Interesting... but I'm using ext4 everywhere so it's OK ^^

> A conventional way is simple - do not deviate from distribution
> defaults (in this case - logging to a package-assigned file).
> In this case such approach solves numerous issues with log rotating, log
> gathering, log analyzing etc.
>
> Of course, there are cases of legitimate needs to deviate from
> distribution defaults. I'd like to hear yours.
>
You mean for this use case writing into /var/log/msmtp?
Actually, I don't really know why but I've decided to write user specific configuration with appropriate logs.
So my conf is not in /etc/msmtprc but in ~/.msmtprc and logging is in the same vein inside ~/.msmtp.log.

Anyway, even if I choose /var/log/msmtp, this directory/file needs to be created so I have the same problematic (except l0f4r0 is not the owner/group of /var/log, but root is), right?


>
>
>> _NB_: by the way, does anybody have a tip to know what user account is
>> used during a specific command please? For example when using
>> echo -e "Subject: mySubject\nThis is myBody" | msmtp my_email_address
>>
>
> Something like this should do it:
>
> cat << EOF | msmtp my_email_address
> From: myFrom <fakeuser@fakedomain.tld>
> Subject: mySubject
>
> This is myBody
> EOF
>
> It won't fool an MTA, of course (you won't override Envelope-From *that*
> easy), but it will show up nicely in your e-mail client.
>
I did that, it works on Gmail ("myFrom" is displayed but "fakeuser@fakedomain.tld" is <mailto:fakeuser@fakedomain.tldis> replaced with "from" value in ~/.msmtprc).
Why do you suggest this to me? What's your point here please? ;)

> If you need to do it for real - consider using "mail" from "bsd-mailx"
> package.
>
Why? More flexible?

>> how can I know for sure which service/technical account is used for
>> writing msmtp logs?
>>
>
> Try executing "ps -ef | grep msmtp".
>
Nothing. This would work for commands taking long time to be processed I think, not quick/almost instantaneous ones...

Best regards,
l0f4r0


Reply to: