cronolog.org
flexible web log rotation
HOME
DOWNLOAD
FEATURES
USAGE
FAQ
BLOG
KNOWN BUGS
SECURITY
PATCHES
USERS
TO DO
HISTORY
LINKS
FEEDBACK
MAILING LIST
ADVERTISING

support cronolog development



Google   HELP


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CRONOLOG: sync with cron scripts



Sascha Klauder schrieb:
> +-- on Wed May  9 18:30:41 2001, Tuc wrote: ---
> | I see it as a low traffic site issue.  We manipulate the files hourly (Customer
> | request) and we found that there were filehandle issues if we started moving
> | it and stuff while the filehandle was still open to it.
>
> Which was exactly my point. I've written a neat perl script meanwhile
> which uses HTTP::Lite to make a request to each site before moving the
> logs away. Tuc and Axel, thanks for answering.
>
> Cheers,
> -sascha
ok, seems i have to answer again.
remember what i suggested to use in httpd.conf?
this:
CustomLog "| /path/cronolog /path2logs/path2only_one_log_in_here/access_log.%Y%m%d%H"
combined
or
CustomLog "| /path/cronolog /path2logs/path2only_one_log_in_here/access_log.%Y%m%d"
combined
why this?
think about:
We all have accesses on WebPages, recorded in a log file.
Now we want to analyse those files and store the content(!) of that file anywhere.
-->Solution from Tuc: creat an "unreal" access after one hour (or day, doesnt
matter).
-->New Problem: Now we have a manipulated LogFile!!
    We have to clean it, i.e. remove our fake accesses (pics, frameset etc.) OR
exclude our fake accesses while analysing.
Both seems IMHO not to be the best solution, cause log-files shouldnt be modified
afterwards or produce the need to configure my analyzes in a special way.
Back to the Problem, we had at first:
We have to store the LogFile and analyze it.
-->My Solution: Just use the line above in httpd.conf.
What happens?
We get a log file. So far so good. Next Step, assuming a hourly "rotation" needed:
After one hour, in the first minute of the next hour, a cron-job starts a prog, that
does the following:
1) "cat (or copy) /path2logs/path2only_one_log_in_here/access_log.%Y%m%d%(lastHour) >
/path2logs/path2stored_logs/access_log.%Y%m%d%(lastHour)"
(NO moving of the file, just take the content out of it! Dont think that should
produce any probs...)
2) look into /path2logs/path2only_one_log_in_here/
and a) do nothing, if there is only one file in it.
or b) remove the access_log.%Y%m%d%(lastHour), if there are two files AND if
/path2logs/path2stored_logs/access_log.%Y%m%d%(lastHour) exists
(the AND just to make sure the file has been "rotated")
Hope thats coherent till now :-)
Now we have two posibilities:
1) There is only one actual access_log, the one cronolog still has open, cause there
was no traffic.
Thats ok for us, cause we have the ("clean") content stored.
And that content wont change anymore!
2) The prog finds two files.
Also ok, we store the content of the lastHour-log and remove the file, cause cronolog
doesnt use it anymore. The actual used file stays where it is.
Please comments, if i made any mistakes in my solution.
thanks for your patience :-))
Yours
Axel

Copyright © 1996-2010 Andrew Ford and Ford & Mason Ltd