browse.html revision c6511e859c35b12de4e6fb5f58d7258d9de3b8f2
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek div#divlogs, div#diventry {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek font-family: monospace;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek background-color: #ffffff;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek margin: 2em 0em;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek border-radius: 10px 10px 10px 10px;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek border: 1px solid threedshadow;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek white-space: nowrap;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek overflow-x: scroll;
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering display: block;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering background-color: #ededed;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering color: #313739;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek font: message-box;
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering text-align: right;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek border-right: 1px dotted lightgrey;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering padding-right: 5px;
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek border-right: 1px dotted lightgrey;
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering padding-left: 5px;
2cf4172a71860c6e44edd27a3b68047ae062d7fcLennart Poettering padding-right: 5px;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering padding-left: 5px;
799a8f39d8eb9ea725e85a598c0f5dbd658c8ba7Zbigniew Jędrzejewski-Szmek td.message > a:link, td.message > a:visited {
799a8f39d8eb9ea725e85a598c0f5dbd658c8ba7Zbigniew Jędrzejewski-Szmek text-decoration: none;
2cf4172a71860c6e44edd27a3b68047ae062d7fcLennart Poettering padding-left: 5px;
7449bc1f34c206e3ff8e274cd74e2db950d492a1Zbigniew Jędrzejewski-Szmek font-weight: bold;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek td.message-error > a:link, td.message-error > a:visited {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek text-decoration: none;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek padding-left: 5px;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek font-weight: bold;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek td.message-highlight > a:link, td.message-highlight > a:visited {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek text-decoration: none;
2cf4172a71860c6e44edd27a3b68047ae062d7fcLennart Poettering color: #313739;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek td > a:hover, td > a:active {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek text-decoration: underline;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek table#tablelogs, table#tableentry {
8847551bcbfa8265bae04f567bb1aadc7b480325Zbigniew Jędrzejewski-Szmek border-collapse: collapse;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek text-align: right;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek border-right: 1px dotted lightgrey;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek padding-right: 5px;
8847551bcbfa8265bae04f567bb1aadc7b480325Zbigniew Jędrzejewski-Szmek padding-left: 5px;
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek - show red lines for reboots
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek - show contents of entries -->
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek <div id="divlogs"><table id="tablelogs"></table></div>
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek <div id="diventry"><table id="tableentry"></table></div>
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek <input id="head" type="button" value="|<" onclick="entriesLoadHead();"/>
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek <input id="previous" type="button" value="<<" onclick="entriesLoadPrevious();"/>
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek <input id="next" type="button" value=">>" onclick="entriesLoadNext();"/>
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek <input id="tail" type="button" value=">|" onclick="entriesLoadTail();"/>
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek <input id="more" type="button" value="More" onclick="entriesMore();"/>
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek <input id="less" type="button" value="Less" onclick="entriesLess();"/>
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek var first_cursor = null;
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek var last_cursor = null;
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt function setCookie(name, value, msec) {
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt var d = new Date();
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek d.setMilliseconds(d.getMilliseconds() + msec);
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek var v = escape(value) + "; expires=" + d.toUTCString();
d71839afd88589247d8dd42b2b09d024f521749dZbigniew Jędrzejewski-Szmek document.cookie = name + "=" + value;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek function getCookie(name) {
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek j = l[i].indexOf("=");
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek x = l[i].substr(0, j);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek y = l[i].substr(j+1);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek return unescape(y);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek function getNEntries() {
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek n = getCookie("n_entries");
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering if (n == null)
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering return parseInt(n);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek function showNEntries(n) {
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering var showing = document.getElementById("showing");
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek showing.innerHTML = "Showing <b>" + n.toString() + "</b> entries.";
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering function setNEntries(n) {
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek setCookie("n_entries", n.toString(), 30*24*60*60*1000);
dacd6cee76a08331b8c8616c5f30f70ee49aa2f9Lennart Poettering showNEntries(n);
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek function machineLoad() {
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek var request = new XMLHttpRequest();
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek request.open("GET", "/machine");
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek request.onreadystatechange = machineOnResult;
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek request.setRequestHeader("Accept", "application/json");
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek function formatBytes(u) {
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek if (u >= 1024*1024*1024*1024)
36d4739a68c3edafe4d145d525a26de4ef0b8e5aZbigniew Jędrzejewski-Szmek return (u/1024/1024/1024/1024).toFixed(1) + " TiB";
36d4739a68c3edafe4d145d525a26de4ef0b8e5aZbigniew Jędrzejewski-Szmek else if (u >= 1024*1024*1024)
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt return (u/1024/1024/1024).toFixed(1) + " GiB";
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt else if (u >= 1024*1024)
eb56eb9b40950f1edcffdb7313f8de4f8572a6d5Michal Schmidt else if (u >= 1024)
36d4739a68c3edafe4d145d525a26de4ef0b8e5aZbigniew Jędrzejewski-Szmek return (u/1024).toFixed(1) + " KiB";
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek function machineOnResult(event) {
722b6795655149a68277b3cffeba711e1d440e5aZbigniew Jędrzejewski-Szmek if ((event.currentTarget.readyState != 4) ||
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek (event.currentTarget.status != 200 && event.currentTarget.status != 0))
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var d = JSON.parse(event.currentTarget.responseText);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var title = document.getElementById("title");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek title.innerHTML = 'Journal of ' + d.hostname;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek document.title = 'Journal of ' + d.hostname;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var machine = document.getElementById("machine");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek machine.innerHTML = 'Machine ID is <b>' + d.machine_id + '</b>, current boot ID is <b>' + d.boot_id + '</b>.';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var cutoff = document.getElementById("cutoff");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var from = new Date(parseInt(d.cutoff_from_realtime) / 1000);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var to = new Date(parseInt(d.cutoff_to_realtime) / 1000);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek cutoff.innerHTML = 'Journal begins at <b>' + from.toLocaleString() + '</b> and ends at <b>' + to.toLocaleString() + '</b>.';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var usage = document.getElementById("usage");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek usage.innerHTML = 'Disk usage is <b>' + formatBytes(parseInt(d.usage)) + '</b>.';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var os = document.getElementById("os");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek os.innerHTML = 'Operating system is <b>' + d.os_pretty_name + '</b>.';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var virtualization = document.getElementById("virtualization");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek virtualization.innerHTML = d.virtualization == "bare" ? "Running on <b>bare metal</b>." : "Running on virtualization <b>" + d.virtualization + "</b>.";
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek function entriesLoad(range) {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var request = new XMLHttpRequest();
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.open("GET", "/entries");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.onreadystatechange = entriesOnResult;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.setRequestHeader("Accept", "application/json");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.setRequestHeader("Range", "entries=" + range + ":" + getNEntries().toString());
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek function entriesLoadNext() {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek if (last_cursor == null)
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek entriesLoad("");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek entriesLoad(last_cursor + ":1");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek function entriesLoadPrevious() {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek if (first_cursor == null)
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek entriesLoad("");
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek entriesLoad(first_cursor + ":-" + getNEntries().toString());
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek function entriesLoadHead() {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek entriesLoad("");
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek function entriesLoadTail() {
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek entriesLoad(":-" + getNEntries().toString());
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek function entriesOnResult(event) {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek if ((event.currentTarget.readyState != 4) ||
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek (event.currentTarget.status != 200 && event.currentTarget.status != 0))
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var logs = document.getElementById("tablelogs");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var l = event.currentTarget.responseText.split('\n');
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek logs.innerHTML = '<tbody><tr><td colspan="3"><i>No further entries...</i></td></tr></tbody>';
8847551bcbfa8265bae04f567bb1aadc7b480325Zbigniew Jędrzejewski-Szmek if (d.MESSAGE == undefined || d.__CURSOR == undefined)
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek priority = parseInt(d.PRIORITY);
eacbb4d33e2bb5c54311544851140efe3dd0f774Zbigniew Jędrzejewski-Szmek clazz = "message-error";
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek else if (priority <= 5)
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek clazz = "message-highlight";
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek clazz = "message";
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek buf += '<tr><td class="timestamp">';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek if (d.__REALTIME_TIMESTAMP != undefined) {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var timestamp = new Date(parseInt(d.__REALTIME_TIMESTAMP) / 1000);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek buf += timestamp.toLocaleString();
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek buf += '</td><td class="process">';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek if (d.SYSLOG_IDENTIFIER != undefined)
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek else if (d.SYSLOG_PID != undefined)
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek buf += "[" + d.SYSLOG_PID + "]";
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek buf += '</td><td class="' + clazz + '"><a href="#entry" onclick="onMessageClick(\'' + lc + '\');">';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek else if (d.MESSAGE instanceof Array)
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek buf += "[" + formatBytes(d.MESSAGE.length) + " blob data]";
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek logs.innerHTML = '<tbody>' + buf + '</tbody>';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek first_cursor = fc;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek last_cursor = lc;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek setNEntries(getNEntries() + 10);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek setNEntries(getNEntries() - 10);
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek function onResultMessageClick(event) {
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek if ((event.currentTarget.readyState != 4) ||
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek (event.currentTarget.status != 200 && event.currentTarget.status != 0))
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var d = JSON.parse(event.currentTarget.responseText);
8201af08fa09c2bd0f005fbe262f27e2c5bd2d86Zbigniew Jędrzejewski-Szmek document.getElementById("diventry").style.display = "block";
8201af08fa09c2bd0f005fbe262f27e2c5bd2d86Zbigniew Jędrzejewski-Szmek entry = document.getElementById("tableentry");
8201af08fa09c2bd0f005fbe262f27e2c5bd2d86Zbigniew Jędrzejewski-Szmek buf += '<tr><td class="field">' + key + '</td><td class="data">' + d[key] + '</td></tr>';
8201af08fa09c2bd0f005fbe262f27e2c5bd2d86Zbigniew Jędrzejewski-Szmek entry.innerHTML = '<tbody>' + buf + '</tbody>';
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek var request = new XMLHttpRequest();
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.open("GET", "/entries?discrete");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.onreadystatechange = onResultMessageClick;
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.setRequestHeader("Accept", "application/json");
3d090cc6f34e5970765dd1e7ee5e648a056d180dZbigniew Jędrzejewski-Szmek request.setRequestHeader("Range", "entries=" + t + ":0:1");