1

want to send log files from Ubuntu Server via email using sendemail but the when I do all the text in the email is all in one big mess ( one space between words new lines and spacing not brought into email ) .. no neat format ? How do I fix formatting of log files for email ? I have a had a little play with fmt but had no joy.

Any hints would be appreciated :)

Thank you

user85644
  • 13
  • 4

2 Answers2

0

Considered using logwatch? I've not noticed any of the formatting problems you describe. As a side effect, you can customize filters in logwatch to only email you unusual log entries, and ignore normal ones.

Mike Renfro
  • 1,281
  • 1
  • 8
  • 11
  • Thanks - i'll take a look at logwatch... Sounds very useful. What im aqm doing is I have a cron job running a shell script to tar.gz files to a NAS and then I want to send a log file of what has happened I may decided to make a weekly table of results to send or something later but for now I want to figure out why the formatting is all bad ? – user85644 Jun 24 '11 at 21:52
  • With respect to your weird formatting issue - maybe you need to manually declare what character encoding your input you're mailing uses...? – James T Snell Jun 24 '11 at 21:59
0

I don't know logwatch and I'm gonna just flat out guess it's better than what I use..

I use "mail", a command-line program, I believe you get it from the package "mailutils". Through that, I have a series of batch scripts that are called as cron jobs.. And those batch scripts will email me using that program. It's basic in features, but it works and is simple to use..

Still, I don't know about logwatch, I suggest you check that out first, unless you need something really basic, then, maybe, "mail" is what suits your needs best. Cheers!

James T Snell
  • 463
  • 2
  • 11