You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
7.2 KiB
Django/Jinja

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon" sizes="180x180" href="">
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<meta property="og:type" content="">
<meta property="og:title" content="">
<meta property="og:image" content="">
<meta property="og:description" content="">
<meta property="og:url" content="">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>TL;DR</h1>
<h2>too log didn't read</h2>
</header>
<nav class="slider slider--top">
<label for="time">time</label>
<input type="range" min="0" max="{{log_files|length}}" id="time" value="0" class="fn-time-slider">
</nav>
<nav class="slider slider--left">
<label for="annotation">annotations</label>
<input type="range" value="0" min="0" max="400" class="vertical fn-annotation-slider">
</nav>
<main>
<div class="main__background">
<div class="main__background--radius"></div>
</div>
<div class="main__inner">
<article>
<h2>What happened today?</h2>
<small>Some temp debug info: This log was generated on {{ now }}, the next will be available after {{ next_report
}}. I now have {{ log_files | length }} logs generated! </small>
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl -S today -u kitchen-stove.service -u
kitchen-bin.service -u kitchen-fridge.service -r -n</p>
{% if kitchen_services|length > 0 %}
<ul>
{% for item in kitchen_services %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% endif %}
<p><span class='hostname'>tldr@chopchop:~ $</span>uptime -s</p>
<p>{{ since_last_boot }}</p>
{% if since_last_boot is defined %}
<span class="annotation fn-annotatation" level="1">
{% if days_since_last_boot|int > 14 %}This is unusual, we are used to ...{% else %}This is common, the
fragility of these machines are more prominant than any cloud user expects. Partially because of scale,
partially because a lot of labour that happen in datacenters just escapes us all when we want to just upload
an image.{% endif %}
</span>
{% endif %}
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl _COMM=useradd -r -n 1 --output-fields=MESSAGE
</p>
<p>{{last_user_added}}</p>
{% if last_user_name is defined %}
<span class="annotation fn-annotatation" level="1">
{{ last_user_name}} user/s was/were added [] days ago, and the network of trust grew ever so slightly.
</span>
{% endif %}
{% if last_user_added is defined %}
<span class="annotation fn-annotatation" level="2">
Users will be trusted with not just the keys and passwords to the "house" which is the server, but with a
portion of responsibility to keep it afloat and contribute to what makes it a community of practices (and
network of knowledge and dependence).
</span>
{% endif %}
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl -S today _COMM=useradd -r</p>
{% if users_created_today is defined %}
<span class="annotation fn-annotatation" level="1">
A level 1 annotation for users_created_today
</span>
{% endif %}
{% if list_package_installs|length > 0 %}
<p><span class='hostname'>tldr@chopchop:~ $</span> grep 'install' /var/log/dpkg.log</p>
<ul>
{% for item in list_package_installs %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% endif %}
{% if list_package_upgrade|length > 0 %}
<p><span class='hostname'>tldr@chopchop:~ $</span> grep 'upgrade' /var/log/dpkg.log</p>
<ul>
{% for item in list_package_upgrade %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% endif %}
{% if list_package_remove|length > 0 %}
<p><span class='hostname'>tldr@chopchop:~ $</span> grep 'remove' /var/log/dpkg.log</p>
<ul>
{% for item in list_package_remove %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% endif %}
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl _COMM=systemd-logind -r
--output-fields=MESSAGE -S today -g "New session" | grep -v 'Boot'</p>
<ul>
{% for item in logins_today %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl _COMM=groupadd -r --output-fields=MESSAGE</p>
<ul>
{% for item in groups_created %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl _COMM=groupremove -r --output-fields=MESSAGE
</p>
<ul>
{% for item in groups_removed %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl _COMM=usermod -r</p>
<ul>
{% for item in user_modified %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo journalctl _COMM=userdel -r</p>
<ul>
{% for item in user_deleted %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<hr/>
<p><span class='hostname'>tldr@chopchop:~ $</span>sudo service --status-all</p>
<ul>
{% for item in list_active_services %}
<li>{{ item }}</li>
{% endfor %}
</ul>
<p><span class='hostname'>tldr@chopchop:~ $</span>getent group</p>
<ul>
{% for item in list_groups %}
<li>{{ item }}</li>
{% endfor %}
</ul>
</article>
</div>
</main>
<aside>
<h3>whoami: {{device_info}}</h3>
<small>{{kernel_version}}, {{debian_version}}</small>
</aside>
<footer>
<h3> current residency {{ip_address}}</h3>
</footer>
<script type="text/javascript">
var allFiles = {{log_files}};
window.addEventListener("DOMContentLoaded", function () {
var nextDate = new Date("{{ next_report }}");
var now = new Date();
var ms = nextDate - now;
console.log("start a timeout in , ", ms);
if (ms > 0) {
window.setTimeout(function () {
// TODO: add a check if there is still an internet connection
// TODO: add a check if there is actually new content?
// TODO: think about server time vs. client time
window.location.reload(true);
}, ms + 10000);
}
});
</script>
<script type="text/javascript" src="script.js"></script>
</body>
</html>