
We have been finding the generated html of our logs to be very useful. We generate them after one of our CI jobs that deploy an OpenStack cloud using RDO. RDO is a community of people using and deploying OpenStack on CentOS, Fedora, and RHEL. [1] Our artifact server keeps our logs and artifacts compressed, and upon access decompresses, parses, and renders them in a browser. In the case of the html files generated by generate_page.sh, since the the open/close html tags are not present it does not set the MIME type correctly and we don't render correctly. An example of this is here: [2] [1] https://www.rdoproject.org/ [2] https://thirdparty-logs.rdoproject.org/jenkins-tripleo-quickstart-periodic-newton-delorean-ha_192gb-17/undercloud/var/log/extra/dstat.html.gz
58 lines
1.0 KiB
Bash
Executable File
58 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
##
|
|
## generate_page.sh
|
|
##
|
|
## Made by gaspar_d
|
|
## Login <d.gasparina@gmail.com>
|
|
##
|
|
## Started on Tue 23 Feb 20:17:04 2016 gaspar_d
|
|
## Last update Wed 11 May 17:54:27 2016 gaspar_d
|
|
##
|
|
|
|
print_usage() {
|
|
cat <<EOF
|
|
OVERVIEW: generate a standalone HTML page that you can share with your colleagues
|
|
USAGE: $0 file1.csv file2.csv ...
|
|
EOF
|
|
|
|
}
|
|
|
|
main() {
|
|
gCSVs=""
|
|
|
|
while [[ "$#" -gt "0" ]]; do
|
|
file=$1
|
|
content=`cat $file`
|
|
gCSVs="${gCSVs}\`${content}\`,"
|
|
shift;
|
|
done
|
|
gCSVs="[${gCSVs%?}]"
|
|
output=$1
|
|
|
|
html=`cat index.html | grep -v stylesheet | grep -v script | grep -v '</body>'`
|
|
echo $html
|
|
for js in js/{d3.min.js,jquery-2.1.4.js,nv.d3.min.js,dashboard.js,graph.js}; do
|
|
echo "<script type='text/javascript'>"
|
|
cat ${js}
|
|
echo "</script>"
|
|
done
|
|
echo "<script type='text/javascript'>gCSVs=${gCSVs};</script>"
|
|
for css in css/*.css; do
|
|
echo "<style>"
|
|
cat ${css}
|
|
echo "</style>"
|
|
done
|
|
|
|
echo "</body>"
|
|
echo "</html>"
|
|
}
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
print_usage $0
|
|
exit 1
|
|
fi
|
|
|
|
main $@
|