Go Back   Cyber Tech Help Support Forums > Software > Web Development & Graphic Design

Notices

Reply
 
Topic Tools
  #1  
Old September 24th, 2007, 08:20 PM
masternige masternige is offline
Senior Member
 
Join Date: Oct 2005
O/S: Linux
Location: Birmingham
Posts: 230
apache 2.0.59 query about log files windows xp pro

Hi My personal webserver sits in a corner chugging along,and its headless I access it through ftp.I was wandering is there a way for my apache log files to be automatically sent from my webserver to my main Desktop pc automatically.
Regards Nige.
__________________
Linux User:426178
Reply With Quote
  #2  
Old September 26th, 2007, 07:51 PM
oracle128's Avatar
oracle128 oracle128 is offline
Α Ω
 
Join Date: Oct 2000
O/S: Windows XP Pro
Location: Melbourne, Australia
Age: 24
Posts: 9,401
You could use a batch file to email the log to you.
First, you will either need SMTP access to an email server (eg. Gmail, or your ISP email account), or be running your own mail server (see here, here or here for free ones).

Next you will need a command line mailer. For the sake of consistency, if you use Blat, you can copy the code I give you.

Put the following in a batch file:
Code:
@echo off
::Get date to a YYYYMMDD format (needs modifying for non-US date formats)
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET dat=%yyyy%%mm%%dd%

::Copy Apache logs and stamp with date string. Erase old logs (Apache will make new ones)
::May have to stop Apache first
cd "c:\path\to\logs\folder\"
copy access.log %dat%_access.log
copy error.log %dat%_error.log
del access.log
del error.log

::Compress logs

::Email logs
c:\blat\full\blat -body "Here are today's logs" -subject "Apache Logs" -to you@mail.com -server localhost -f you@mail.com -attach %dat%_access.log -attach %dat%_error.log
Make sure you change the obvious stuff - body text, subject, your email address, path to logs folder, path to Blat.exe, etc. If you use an external SMTP server, change the server parameters. Blat comes with a syntax guide so you should be able to figure it all out.

If your logs get big, you'll want to compress them - 7-Zip would be handy to use since it will happily compress files using the command line. Its commands are documented too.

Also make sure that your messages aren't being marked as spam by your mail host, it will be the source of many frustrations (like it was for me while testing these procedures).
__________________
Oracle's backup tutorial

"A lot of people say games are addictive. Well, they're addictive in the sense that anything you like doing you repeat endlessly. But no one would say, 'Mr Kasparov, you have a chess problem,' or 'Tiger Woods, you have a golf addiction.'" - Ian Livingstone, Creative Director, Eidos.

"A problem well stated is a problem half solved" - Charles Franklin Kettering
Reply With Quote
  #3  
Old September 26th, 2007, 08:01 PM
masternige masternige is offline
Senior Member
 
Join Date: Oct 2005
O/S: Linux
Location: Birmingham
Posts: 230
Thats a fantastic reply i will give it a shot.
Cheers oracle128
ps How does one come up with a username like oracle128.
Regards Nige.
__________________
Linux User:426178
Reply With Quote
  #4  
Old September 27th, 2007, 09:51 AM
oracle128's Avatar
oracle128 oracle128 is offline
Α Ω
 
Join Date: Oct 2000
O/S: Windows XP Pro
Location: Melbourne, Australia
Age: 24
Posts: 9,401
No problem.
It's a combination of oracle (a wise, prophetic mystical being) and the amount of RAM in the computer I was using at the time (I needed a number since "oracle" was already taken). This was back in the days when ICQ was popular.
__________________
Oracle's backup tutorial

"A lot of people say games are addictive. Well, they're addictive in the sense that anything you like doing you repeat endlessly. But no one would say, 'Mr Kasparov, you have a chess problem,' or 'Tiger Woods, you have a golf addiction.'" - Ian Livingstone, Creative Director, Eidos.

"A problem well stated is a problem half solved" - Charles Franklin Kettering
Reply With Quote
Reply

Bookmarks

Topic Tools

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 On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:00 PM.

[ RSS ]