Not able to mail logfiles using logrotate

Hello All,

I have setup a new log and want to mail the log file daily at the end of the day. Logrotate has a mail and mailfirst option available, but it sends the content of the log file in mail but does not send the logfile as an attachment. Does logrotate behave like this or is there any other option which attaches the actual logfile?

Here are the contents of the file.

/etc/logrotate.d/script_mem
/opt/test_cron.log
{
daily
rotate 3
dateext
compress
mail @*.com
mailfirst
}

Thanks,
agarud

Hi agarud,

Does logrotate behave like this

from “man logrotate”:

[QUOTE] [FONT=monospace][COLOR=#000000] [/COLOR][COLOR=#000000]-m, --mail [/COLOR][COLOR=#000000] [/COLOR]
Tells [COLOR=#000000]logrotate [/COLOR][COLOR=#000000]which command to use when mailing logs. This command should accept two arguments: 1) the subject of the message, and 2) the recipient. The command must then read a message on standard input and mail it to the recipient. The default [/COLOR]
mail command is [COLOR=#000000]/bin/mail -s[/COLOR][COLOR=#000000].[/QUOTE][/COLOR]

Regards,
Jens
[/FONT]

[QUOTE=jmozdzen;28930]Hi agarud,

Does logrotate behave like this

from “man logrotate”:

[/COLOR]

Regards,
Jens
[/FONT][/QUOTE]

HI Jens,

Used the full path for the mail option but still it does not send the attachment.

thanks
agarud

Hi agarud,

[QUOTE=agarud;28940]HI Jens,

Used the full path for the mail option but still it does not send the attachment.[/QUOTE]

the key may be the following part of the man page: “[FONT=monospace][COLOR=#000000]The command must then read a message on standard input and mail it to the recipient.” As the mail command puts everything from stdin into the body of the message, nothing es is to be expected.

Regards,
Jens
[/COLOR][/FONT]