Created
March 27, 2012 14:27
-
-
Save zuriby/2216379 to your computer and use it in GitHub Desktop.
yada yada
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for logfile in iglob(os.path.join(path, '*.log')): | |
# e.g. '2012-12-31' | |
today_stamp = gen_stamp() | |
# example.com.[error.]log -> example.com | |
domain_name = parse_domain_name(logfile) | |
# new file name: $date_stamp-$domainname.log | |
rotate_name = today_stamp + '-' + logfile | |
# rotate file. | |
shutil.move(logfile, rotated_name) | |
# read data and update database | |
parse_file(rotated_name) | |
#if there is no tar for today for the current domain, create one. | |
with tarfile.open("sample.tar", "a:gz") as tar: | |
tar.add(rotated_name) | |
# push yesterday's tars into web_server | |
do_push_over_ssh_yada_yada |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment