Need help with daily raw access logs being emailed via a cron

Asked by:
webster
Time:
2011-08-04 4:31 am
Category:
Cpanel
Hits:
1,928
I am trying to get my access logs emailed to a gmail account and it keeps giving me and error

tar: Removing leading `/' from member names

this is the code:
cd /home/user/access-logs
rm -f /home/user/accesS_logs.tar.gz
tar -zcvf /home/user/accesS_logs.tar.gz /home/user/access-logs/*
cd /home/user/
mutt -a accesS_logs.tar.gz myemail@gmail.com -s "RAW Log Backup" -f /home/user/mail_body

You must login before you can ask a follow up question.

You must login before you can submit an answer.

Best answer chosen by Web Hosting Hub staff

0

bwmarkle
2011-08-04 1:07 pm
Hi webster,

I checked and mutt does not seemed to be installed on the servers, so this is why you're receiving an error message.

I tested a few options, and I was able to get the following cron command to work:

<div class="code_block">for i in `ls /home/user/access-logs/`; do mail -s "$i" "you@yourdomain.com" < /home/user/access-logs/$i;done;</div>

What this does is sends you a separate email for each file in the access-logs directory. The subject of the email is the log file name, and the body is the actual log.

I hope this helps!

Thanks,

- Brad

You must login before you can post a comment about this answer.

Like this Question?

Have a Question?

If you need some help, submit your question to our Community! We guarantee a response within 60 minutes (8am - 9pm EST, Monday - Friday)

Recent Questions

  1. Site under brute force attack
  2. URLs in Installation of WordPress Don't Redirect
  3. Choosing a Directory With WordPress

Support Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.