Re: [systemd-devel] Systemd service and structured logging

2019-05-03 Thread Jérémy ROSEN
if you want the whole power of structured logs, you need to use the
journald API
I am not sure in what language your program is written, but if you are
using C, it's pretty trivial to do
(and i'm pretty sure most bindings are trivial to use too)

Automated parsing of stdout is limited, you can
* add a (constant) key=value to all messge
* automatically parse a "" prefix and transform that into a message
gravity
and that's pabasically it. for anything more complex, you need to go
through the journald API

Le ven. 3 mai 2019 à 11:14, Thomas Güttler  a
écrit :

> I have a systemd service which is of type "simple".
>
> I want my service to log key-value pairs.
>
> Is there a way to use structured logs with systemd?
>
> For example my service writes this to stdout:
>
> {"key1": "value1", "key2": 1234}
> {"key1": "value2", "key2": 5678}
> ...
>
>
> It would be great of systemd could read the string as json.
>
> Related question at StackO:
> https://stackoverflow.com/questions/55806921/systemd-service-and-structured-logging
>
> I see two ways:
>
> V1: my logs get stored in journald as message (as plain string).
>
> V2: my key-value pairs get stored in the journald key-value dictionary.
>
> What do you suggest?
>
> Background: I don't want an ELK stack. I want a simple solution. Since
> journald already has key-value pairs for a log entry, why not use it?
>
>
> --
> Thomas Guettler http://www.thomas-guettler.de/
> I am looking for feedback:
> https://github.com/guettli/programming-guidelines
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel



-- 
[image: SMILE]  

20 rue des Jardins
92600 Asnières-sur-Seine
*Jérémy ROSEN*
Architecte technique

[image: email] jeremy.ro...@smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter]  [image: Facebook]
 [image: LinkedIn]
 [image: Github]


[image: Découvrez l’univers Smile, rendez-vous sur smile.eu]

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] Systemd service and structured logging

2019-05-03 Thread Thomas Güttler

I have a systemd service which is of type "simple".

I want my service to log key-value pairs.

Is there a way to use structured logs with systemd?

For example my service writes this to stdout:

{"key1": "value1", "key2": 1234}
{"key1": "value2", "key2": 5678}
...


It would be great of systemd could read the string as json.

Related question at StackO: 
https://stackoverflow.com/questions/55806921/systemd-service-and-structured-logging

I see two ways:

V1: my logs get stored in journald as message (as plain string).

V2: my key-value pairs get stored in the journald key-value dictionary.

What do you suggest?

Background: I don't want an ELK stack. I want a simple solution. Since
journald already has key-value pairs for a log entry, why not use it?


--
Thomas Guettler http://www.thomas-guettler.de/
I am looking for feedback: https://github.com/guettli/programming-guidelines
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] EFI loader partition unknown

2019-05-03 Thread Lennart Poettering
On Fr, 03.05.19 00:37, Chris Murphy (li...@colorremedies.com) wrote:

> systemd-242-3.git7a6d834.fc31.x86_64
>
> With the Fedora /etc/fstab entry for /boot/efi commented out, systemd
> isn't discovering the EFI system partition and mounting it. The /efi
> directory exists, and I've tried to boot with both enforcing=0 and
> selinux=0 due to and selinux bug [1] but systemd doesn't even attempt
> to mount it. Should I file an upstream bug report?
>
>
> [6.275104] frawvm.local systemd-gpt-auto-generator[636]: Waiting
> for device (parent + 3 partitions) to appear...
> [6.281265] frawvm.local systemd-gpt-auto-generator[636]: EFI
> loader partition unknown.
>
> blkid reports:
> /dev/vda1: SEC_TYPE="msdos" UUID="927C-932C" TYPE="vfat"
> PARTLABEL="EFI System Partition"
> PARTUUID="0e3a48c0-3f1b-4ca7-99f4-32fd1d831cdc"
>
> gdisk reports:
> Partition number (1-3): 1
> Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
> Partition unique GUID: 0E3A48C0-3F1B-4CA7-99F4-32FD1D831CDC
> First sector: 2048 (at 1024.0 KiB)
> Last sector: 411647 (at 201.0 MiB)
> Partition size: 409600 sectors (200.0 MiB)
> Attribute flags: 
> Partition name: 'EFI System Partition'
>

What does '/usr/lib/systemd/systemd-dissect /dev/vda' say?

Lennart

--
Lennart Poettering, Berlin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] EFI loader partition unknown

2019-05-03 Thread Chris Murphy
systemd-242-3.git7a6d834.fc31.x86_64

With the Fedora /etc/fstab entry for /boot/efi commented out, systemd
isn't discovering the EFI system partition and mounting it. The /efi
directory exists, and I've tried to boot with both enforcing=0 and
selinux=0 due to and selinux bug [1] but systemd doesn't even attempt
to mount it. Should I file an upstream bug report?


[6.275104] frawvm.local systemd-gpt-auto-generator[636]: Waiting
for device (parent + 3 partitions) to appear...
[6.281265] frawvm.local systemd-gpt-auto-generator[636]: EFI
loader partition unknown.

blkid reports:
/dev/vda1: SEC_TYPE="msdos" UUID="927C-932C" TYPE="vfat"
PARTLABEL="EFI System Partition"
PARTUUID="0e3a48c0-3f1b-4ca7-99f4-32fd1d831cdc"

gdisk reports:
Partition number (1-3): 1
Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
Partition unique GUID: 0E3A48C0-3F1B-4CA7-99F4-32FD1D831CDC
First sector: 2048 (at 1024.0 KiB)
Last sector: 411647 (at 201.0 MiB)
Partition size: 409600 sectors (200.0 MiB)
Attribute flags: 
Partition name: 'EFI System Partition'



[1]
https://bugzilla.redhat.com/show_bug.cgi?id=1293725

-- 
Chris Murphy
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel