# Not able to mail logfiles using logrotate

**URL:** <https://forums.suse.com/t/not-able-to-mail-logfiles-using-logrotate/27287>\
**Category:** SLES Configure-Administer\
**Created:** [July 30, 2015, 11:37am UTC](https://forums.suse.com/t/not-able-to-mail-logfiles-using-logrotate/27287 "2015-07-30T11:37:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![agarud](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@agarud](https://forums.suse.com/u/agarud)\
**Post date:** [July 30, 2015, 11:37am UTC](https://forums.suse.com/t/not-able-to-mail-logfiles-using-logrotate/27287/1 "2015-07-30T11:37:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [July 30, 2015, 2:14pm UTC](https://forums.suse.com/t/not-able-to-mail-logfiles-using-logrotate/27287/2 "2015-07-30T14:14:26Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![agarud](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@agarud](https://forums.suse.com/u/agarud)\
**Post date:** [July 31, 2015, 9:55am UTC](https://forums.suse.com/t/not-able-to-mail-logfiles-using-logrotate/27287/3 "2015-07-31T09:55:59Z")

</div>

[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

---

<div class="post-metadata">

**Author:** ![Jens-U](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@Jens-U](https://forums.suse.com/u/Jens-U)\
**Post date:** [July 31, 2015, 12:38pm UTC](https://forums.suse.com/t/not-able-to-mail-logfiles-using-logrotate/27287/4 "2015-07-31T12:38:11Z")

</div>

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]
