Statistics/Commands

From FedoraProject

Jump to: navigation, search

These are the command line recipes for the metrics shown on the Statistics page.

Contents

Yum

New Way

SSH to log1 and:

cat /srv/www/fedoraUsage/updates-released-f21

NOTE: The script used to produce this file is in the fedora-infrastructure.git repo which is publicly accessible

A collection of scripts currently used on the logging host as a personal cronjob can be found here: [1]

Old Way (deprecated)

SSH to lockbox and:

egrep 'repo=updates-released-f9' \
/var/log/httpd/archives/proxy*/mirrors.fedoraproject.org-access.log.<date_range> | \
grep '\" 200 ' | awk '{print $1}' | awk -F : '{print $2}' | \
sort | uniq | wc -l > ~/f9-yum-<end_date>.txt

Direct Downloads

SSH to log1 and:

egrep 'Fedora-21.*\.iso' \
/var/log/hosts/proxy*/YYYY/MM/DD/http/download.fedoraproject.org-access.log | \
grep '\" 302 ' | awk '{print $1}' | awk -F : '{print $2}' | sort | uniq | wc -l \
> ~/f21-dl-$(date +%Y%m%d).txt

This script appears to work well:

#!/bin/bash
#

[ -n "$NDAYS" ] || NDAYS=7
[ -n "$RELEASE" ] || RELEASE=10

for D in $(seq $NDAYS -1 1)
do
  YEAR=`date -d "$D days ago" +"%Y"`
  MONTH=`date -d "$D days ago" +"%m"`
  DAY=`date -d "$D days ago" +"%d"`
  egrep "Fedora-$RELEASE.*\.iso" \
      /var/log/hosts/proxy*/${YEAR}/${MONTH}/${DAY}/http/download.fedoraproject.org-access.log | \
      grep '\" 302 ' | awk '{print $1}' | awk -F : '{print $2}' | \
      sort | uniq | wc -l \
      > ~/f${RELEASE}-dl-${YEAR}${MONTH}${DAY}.txt
done

Fedoraproject.org Visits

Go here. Also, for example:

for month in `seq -w 9 10`; do echo -n "$month "; (bzcat \
  /var/log/hosts/proxy[1-5]/2008/$month/*/http/fedoraproject.org-access.* \
  2> /dev/null || cat \
  /var/log/hosts/proxy[1-5]/2008/$month/*/http/fedoraproject.org-access.*) | \
  awk '{print $1 }' | sort | uniq | wc -l ; done

Wiki Edits

for month in `seq -w 5 10`; do echo -n "$month "; (bzgrep -hce 'POST.*edit' \
  /var/log/hosts/proxy[1-5]/2008/$month/*/http/fedoraproject.org-access.* \
  2> /dev/null || grep -hce 'POST.*edit' \
  /var/log/hosts/proxy[1-5]/2008/$month/*/http/fedoraproject.org-access.*) | \
  awk '{ s+=$1 } END { print "Total: "s}'; done