Vamos a ver lo simple y fácil que es crear unas simples estadisticas de los logs de acceso en el framework Jira de Atlassian, para ello usaremos la aplicación HTTP Requests Log Analyser.
Documentación (JIRA HTTP Requests Log Analyser): https://confluence.atlassian.com/display/ATLAS/JIRA+HTTP+Requests+Log+Analyser.
Creamos el directorio /opt/atlassian/accesslog/.
mkdir /opt/atlassian/accesslog/
Descargamos en dicho directorio “http Request log analyser".
Este script agrupará los tres archivos que genera ”JIRA HTTP Requests Log Analyser“ en un solo documento html. Se presupone que los logs de acceso están en la ruta /opt/atlassian/jira/logs.
#!/bin/bash cd /opt/atlassian/jira/atlassian-jira/report; java -jar /opt/atlassian/accesslog/access-log-analyser-1.1.jar file=/opt/atlassian/jira/logs/access_log.*; echo "<br/><br/><br/><hr><br/><br/><h2>Incoming requests by categories</h2><pre>" > /opt/atlassian/jira/atlassian-jira/report/caca.txt; cat /opt/atlassian/jira/atlassian-jira/report/request-log-summary.wiki >> /opt/atlassian/jira/atlassian-jira/report/caca.txt; echo "</pre><br/><br/><br/><hr><br/><br/><h2>TOP 20 Unknown requests.</h2><pre>" >> /opt/atlassian/jira/atlassian-jira/report/caca.txt; cat /opt/atlassian/jira/atlassian-jira/report/unknown-requests.txt >> /opt/atlassian/jira/atlassian-jira/report/caca.txt; echo "</pre>" >> /opt/atlassian/jira/atlassian-jira/report/caca.txt; sed '/<\/div>/r /opt/atlassian/jira/atlassian-jira/report/caca.txt' /opt/atlassian/jira/atlassian-jira/report/requests-over-time.html > /opt/atlassian/jira/atlassian-jira/report/index.html; rm -rf /opt/atlassian/jira/atlassian-jira/report/reque* /opt/atlassian/jira/atlassian-jira/report/*.txt; chmod u+x /opt/atlassian/accesslog/jiraloganalyzer.sh
Creamos una tarea en el cron (Cada hora de lunes a viernes).
0 * * * 1,2,3,4,5 /opt/atlassian/accesslog/jiraloganalyzer.sh >/dev/null 2>&1