Skip to content

Commit

Permalink
automate rss stats collection
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Dec 13, 2021
1 parent 1cddfaa commit b125154
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions puppet/modules/web/files/rss-stat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

LOGPREFIX="/var/log/httpd/web-https_access_ssl.log-"
OUTPUT=/var/log/rss-stat

for logfile in ${LOGPREFIX}*; do
logsuffix=${logfile#${LOGPREFIX}}
outfile="${OUTPUT}/rss-stat-${logsuffix}.gz"
if [[ ! -f ${outfile} ]]; then
grep 'feed.xml.*"Foreman/' ${logfile} | gzip > ${outfile}
fi
done
16 changes: 16 additions & 0 deletions puppet/modules/web/manifests/vhost/web.pp
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,20 @@
script_content => file('web/rsync.sh'),
}
}

# Generate RSS stats
file { '/var/log/rss-stat':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0750',
}

file { '/etc/cron.weekly/rss-stat':
ensure => file,
owner => 'root',
group => 'root',
mode => '0755',
content => file('web/rss-stat.sh'),
}
}

0 comments on commit b125154

Please sign in to comment.