From: Paul Norman Date: Sat, 25 Jun 2022 05:32:11 +0000 (-0700) Subject: Produce per-host referer logs for tiles X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/537037d57a597aee1cbddb7699c17a71fc20d4c1 Produce per-host referer logs for tiles This upgrades to tilelog 1.1.0 which allows producing multiple files, one of which is the existing log, the other is a log of top-usage websites --- diff --git a/cookbooks/tilelog/recipes/default.rb b/cookbooks/tilelog/recipes/default.rb index dd2e03d0d..41051bba0 100644 --- a/cookbooks/tilelog/recipes/default.rb +++ b/cookbooks/tilelog/recipes/default.rb @@ -31,7 +31,7 @@ end python_package "tilelog" do python_virtualenv tilelog_directory python_version "3" - version "0.4.0" + version "1.1.0" end directory tilelog_output_directory do diff --git a/cookbooks/tilelog/templates/default/tilelog.erb b/cookbooks/tilelog/templates/default/tilelog.erb index 7e2e23fd7..06014803d 100644 --- a/cookbooks/tilelog/templates/default/tilelog.erb +++ b/cookbooks/tilelog/templates/default/tilelog.erb @@ -1,4 +1,5 @@ #!/bin/sh +set -e if [ -z "$DATE" ] then @@ -8,12 +9,18 @@ fi OUTDIR="<%= @output_dir %>" TMPDIR=$(mktemp -d -t tilelog.XXXXXXXXX) -cd $TMPDIR +cd "$TMPDIR" export AWS_ACCESS_KEY_ID="AKIASQUXHPE7JFCFMOUP" export AWS_SECRET_ACCESS_KEY="<%= @aws_key %>" export AWS_REGION="eu-west-1" -nice -n 19 /opt/tilelog/bin/tilelog --date ${DATE} && mv tiles-${DATE}.txt.xz "${OUTDIR}" +TILEFILE="tiles-${DATE}.txt.xz" +HOSTFILE="hosts-${DATE}.csv" -rm -rf $TMPDIR +nice -n 19 /opt/tilelog/bin/tilelog --date "${DATE}" \ + --tile "${TILEFILE}" --host "${HOSTFILE}" + +mv "${TILEFILE}" "${HOSTFILE}" "${OUTDIR}" + +rm -rf "$TMPDIR"