mail access_log


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers mail access_log
# 1  
Old 11-27-2001
mail access_log

i am trying to figure a way to email my access_log twice a month to myself right before the system zeros it.

using crontab is the way to go, but the command to get mail to do the job is my problem.

#-------------------------------------------
#0-59 0-23 1-31 1-12 0-6 (0=Sunday)
#min hour date month day command
#-------------------------------------------

* 0 * 15 * * cat home/aherbel/logs/access_log.resolved | tar access.tar | gzip access.tar.gz | mail -s ",subject,email@domain.com

* 0 * 30 * * cat home/aherbel/logs/access_log.resolved | tar access.tar | gzip access.tar.gz | mail -s ",subject,email@domain.com


i got most of this from the FAQ's, but got this error.


/bin/sh: -c: line 2: syntax error: unexpected end of file

thanks
# 2  
Old 11-27-2001
When you use pipe [ | ] you must work with stdin and/or stdout, not filenames. At the second, you didn't write tar command. At the third - why do you want to tar 1 file ?

At the fourth - "mail" don't send you compressed file as attachement but as message body. You have to use some combination of the MIME command to create attachement. Better is to use "mutt"

Your command pipe should be as folows:

cat logfile | gzip logfile.gz; mutt -s "logfile" -a logfile.gz email@domain.com
# 3  
Old 11-27-2001
also instead of having two lines in the crontab, you could just have one. (although two is fine)

* 0 * 15,30 * * cat logfile | gzip logfile.gz; mutt -s "logfile" -a logfile.gz email@domain.com
# 4  
Old 11-27-2001
#-------------------------------------------
#0-59 0-23 1-31 1-12 0-6 (0=Sunday)
#min hour date month day command
#-------------------------------------------


59 23 14 * * * metasend -b -t email@domain.com -s "Logs" -mtext/plain -f ~/logs/access_log.resolved

59 23 30 * * * metasend -b -t email@domain.com -s "Logs" -mtext/plain -f ~/logs/access_log.resolved

This works except for reading the file when i get it. it sends three separate parts and i can't figure out how to combine the parts and decode. i looked at the source and it appears to be rich text.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Shell Programming and Scripting

Access_log parsing and blocking ip

Hello, my website under http get attack. When i check the access_log i can see like this. xx.xxx.xxx.xxx - - "GET //wp-admin/blabla/test.php?jASHSSAsgaGSAgsASGIGIG HTTP/1.1" 200 0 "-" "-" xxx.xxx.x.xx - - "GET //wp-admin/blabla/test.php?jASHSSAsgaGSAgsASGIGIG HTTP/1.1" 200 0 "-" "-" ... (3 Replies)
Discussion started by: SAYGIN
3 Replies

3. Linux

Finding IP info from access_log file

I found the /var/www/logs/access_log file (access log in order to find specific information about IP, And when users last logged in.) but in my fedora the access_log file is is in my /var/log/cups and it looks different from what it should be. Why is that? my goal is to get a list of IP... (4 Replies)
Discussion started by: bugenhagen_
4 Replies

4. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

5. Web Development

Include CFTOKEN and CFID in apache access_log

hi folks, how to write CFID and CFTOKEN cookie in apache logs ? can you give me a link or howtos in doing this. thanks in advance (0 Replies)
Discussion started by: linuxgeek
0 Replies

6. Solaris

how to grep or egrep pattern of apache access_log file

Hi I need to look for the range dates of access_log for example: between 02/May/2009:14:56:20 and 05/May/2009:18:46:06 then write the content to another file. Date and time is very important for me to concatenate them into access_log later. Thanks (2 Replies)
Discussion started by: lamoul
2 Replies

7. UNIX for Dummies Questions & Answers

Deleting access_log.processed in crontab

Hi, I've worked out that my server was getting clogged with the access_log.processed file. I deleted it using the command > /var/www/vhosts/domain.com/statistics/logs/access_log.processed I also set that up as a crontab job for every Wednesday. What I was wondering is the version using... (4 Replies)
Discussion started by: chickenhouse
4 Replies

8. Solaris

how to forward mail in /var/mail/username to external mail

Dear All, Now I use solaris 10 and I try to forward mail from /var/mail/username to their external mail so what should I do? thank u in advance (2 Replies)
Discussion started by: unitipon
2 Replies

9. UNIX for Dummies Questions & Answers

mail problem (NOT Mail or Mail.app)

When I try to use the CLI mail, I get the following error. What's wrong? Welcome to Darwin! % mail root Subject: test test . EOT % /etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory Do I just need to change the... (1 Reply)
Discussion started by: chenly
1 Replies

10. Cybersecurity

/var/log/httpd/access_log

Yesterday I happened to check /var/log/httpd/access_log and found some funny things like these, 209.127.62.159 - - "GET /scripts/root.exe?/c+dir HTTP/1.0" 404 210 209.127.62.159 - - "GET /MSADC/root.exe?/c+dir HTTP/1.0" 404 208 209.127.62.159 - - "GET /c/winnt/system32/cmd.exe?/c+dir... (3 Replies)
Discussion started by: eddie
3 Replies
Login or Register to Ask a Question