service_logs.jinja2 1.22 KB
Newer Older
Daniele Venzano's avatar
Daniele Venzano committed
1
{% extends "base_user.jinja2" %}
2
{% block title %}Service {{ service.name }} logs{% endblock %}
3 4 5
{% block custom_head %}
    <script type="text/javascript" src="{{ static_url("logtail.js") }}"></script>
{% endblock %}
6 7 8 9 10
{% block content %}
    <h1>Zoe - Analytics on demand</h1>

<h2>{{ service.name }} console output</h2>

11 12
    <p>Note: timestamps in logs are recorded in the UTC timezone.</p>

13 14
<textarea class="logoutput" id="logoutput" readonly>
</textarea>
15 16 17 18 19
<a id="pause" href='#'>Pause</a>

    {% if not use_websockets %}
    <p>Please note: only the last 30kB of the log are shown when the page is loaded.</p>
    {% endif %}
20 21 22 23

<p><a href="{{ reverse_url("execution_inspect", service.execution_id) }}">Back to execution details</a></p>

<script type="application/javascript">
24
    {% if use_websockets %}
25
var ws = new WebSocket('{{ websocket_base }}/websocket');
26 27 28 29 30 31
ws.onopen = function (e) {
    ws.send(JSON.stringify({
        command: "service_logs",
        service_id: {{ service.id }}
    }));
};
32
var log_element = $('#logoutput');
33
ws.onmessage = function (evt) {
34 35
    log_element.append(evt.data);
    log_element.scrollTop(log_element[0].scrollHeight);
36
};
37 38 39
    {% else %}
logtail("{{ log_path }}");
    {% endif %}
40 41 42
</script>

{% endblock %}