misc: display unit name
This commit is contained in:
parent
95960d3b6c
commit
b202828360
|
@ -20,9 +20,10 @@ class Command(BaseCommand):
|
|||
def handle(self, *args, **options):
|
||||
_, columns = os.popen("stty size", "r").read().split()
|
||||
for entry in Entry.objects.dump(lines=options['lines']):
|
||||
line = "%s %s %s" % (
|
||||
line = "%s %s %s %s" % (
|
||||
entry.timestamp.astimezone().strftime("%b %d %X"),
|
||||
entry.host,
|
||||
entry.unit,
|
||||
entry.data.get("MESSAGE"),
|
||||
)
|
||||
priority = entry.data.get("PRIORITY")
|
||||
|
|
|
@ -26,3 +26,7 @@ class Entry(models.Model):
|
|||
|
||||
def __str__(self):
|
||||
return '%s %s %s' % (self.timestamp, self.host, self.data)
|
||||
|
||||
@property
|
||||
def unit(self):
|
||||
return self.data.get('_SYSTEMD_UNIT', '').replace('.service', '')
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<tr>
|
||||
<td>Time</td>
|
||||
<td>Host</td>
|
||||
<td>Unit</td>
|
||||
<td>Message</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -17,6 +18,7 @@
|
|||
<tr>
|
||||
<td>{{ line.timestamp|date:'b d H:i:s' }}</td>
|
||||
<td>{{ line.host }}</td>
|
||||
<td>{{ line.unit }}</td>
|
||||
<td>{{ line.data.MESSAGE }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
|
|
Reference in New Issue