summaryrefslogtreecommitdiff
path: root/bin/weblogs-merge
diff options
context:
space:
mode:
Diffstat (limited to 'bin/weblogs-merge')
-rwxr-xr-xbin/weblogs-merge18
1 files changed, 10 insertions, 8 deletions
diff --git a/bin/weblogs-merge b/bin/weblogs-merge
index 1f10cae..60898a3 100755
--- a/bin/weblogs-merge
+++ b/bin/weblogs-merge
@@ -76,21 +76,23 @@ Dir.glob("*").each{ |client|
exit 1
end
+ # move yyyy-mm-dd to yyyy-mm
getfilelist(root+"/"+client+"/"+dir).each { |sourcefile|
- m = /(.*-(?:access|error).log.)(\d+)-(\d+).gz/.match(sourcefile)
+ m = /(.*-(?:access|error).log.)(\d+)-(\d+)-(\d+).gz/.match(sourcefile)
next unless m
- dummy, name, year, month = m.to_a
- next if this_year == year
- targetfile = "#{name}#{year}.gz"
+ dummy, name, year, month, day = m.to_a
+ next if this_year == year && this_month == month
+ targetfile = "#{name}#{year}-#{month}.gz"
append_and_remove(sourcefile, targetfile)
}
+ # move yyyy-mm to yyyy
getfilelist(root+"/"+client+"/"+dir).each { |sourcefile|
- m = /(.*-(?:access|error).log.)(\d+)-(\d+)-(\d+).gz/.match(sourcefile)
+ m = /(.*-(?:access|error).log.)(\d+)-(\d+).gz/.match(sourcefile)
next unless m
- dummy, name, year, month, day = m.to_a
- next if this_year == year && this_month == month
- targetfile = "#{name}#{year}-#{month}.gz"
+ dummy, name, year, month = m.to_a
+ next if this_year == year
+ targetfile = "#{name}#{year}.gz"
append_and_remove(sourcefile, targetfile)
}
}