LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-22-2013, 04:16 AM   #1
Nikhil_Lagwankar
Member
 
Registered: Aug 2013
Location: Pune
Distribution: Centos, Ubuntu, Fedora
Posts: 36

Rep: Reputation: 0
Question How to send log files to a particular e-mail address?


hi,

i'm using CentOS 6.4[Final].

Suppose i have a tool which generates a log file of the system after every 24 hours.

How do i send the log file to a particular email address.

I basically wish to automate this process so that i can view these logs via e-mail.

Do i need to install mail servers?? What else do i need to do here?

Thanks in advance...
 
Old 12-22-2013, 05:03 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
CentOS and many other distribution have a mail server already installed, since some processes use mail to send messages to the system administrator or to the crontab owners. Therefore you can simply do something like:
Code:
(
 echo "From: Sender <sender@domain>"
 echo "To: Recipient <recipient@domain>"
 echo "Subject: This is log of today $(date)"
 cat file.log
) | /usr/sbin/sendmail "recipient@domain"
If you prefer to send the log as attachment, you can try mutt or uuenview. Example:
Code:
/usr/bin/uuenview -m "recipient@domain" -f "sender@domain" -s "This is log of today $(date)" -a file.log <<-EOF
	Log in attachment.
	
	Greetings,
	Me
	
	EOF
The uuenview command is provided by the uudeview package.
 
Old 12-22-2013, 05:03 AM   #3
fuorviato
Member
 
Registered: Dec 2013
Location: Poland
Distribution: Sabayon/Gentoo 64bit
Posts: 215

Rep: Reputation: 14
Have a look here
 
Old 12-22-2013, 05:10 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...additionally human users usually do not have the time or the attention span to wade through loads of log files, let alone do that in a disciplined way regularly. So Logwatch probably is easiest for parsing logs and mailing a report.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Mail and Mutt send mail to from address Pf945sm Linux - Server 4 12-03-2013 01:34 PM
sendmail: how to send mail from my yahoo e-mail address harryhaller Slackware 3 11-13-2006 11:00 PM
'send from' address using /bin/mail turbo_acura Linux - Software 1 01-17-2006 11:25 AM
send mail to external email address hamish Linux - Networking 8 12-10-2004 09:17 AM
Send mail listening address? bradyc Linux - Newbie 4 02-06-2004 08:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration