Re: [systemd-devel] Prefix for direct logging

2021-09-27 Thread Arjun D R
Thank you Mantas for the details.
How do you currently get the logs "every few seconds"?
> Actually we have a script that will be triggered every 10 seconds. That
script will run "journalctl -u " and redirect the output to the
respective log file. We will run journalctl for around 40-50 services for
every 10 seconds and redirect it to the respective log files. That may be a
bad idea, but this is how we are collecting logs as of now. We need to
separate the logs for every service and that's why we ended up with this
implementation.

Ah, ok so StandardOutput:file: will allow the service to open the
fd and directly connect it to the service stdout.

Let me look into journalctl --follow. Any other alternative approaches for
the above implementation?

Thanks again Mantas.

--
Arjun

On Mon, Sep 27, 2021 at 11:39 PM Mantas Mikulėnas  wrote:

>
> On Mon, Sep 27, 2021 at 1:11 PM Arjun D R  wrote:
>
>> Hi Folks,
>>
>> Currently we are using systemd-journald for service logging. We run
>> journalctl for a bunch of services and redirect those to the custom log
>> files for every few seconds. This takes up the CPU for that particular
>> time period since we have lot of IO operations as well. We came to know
>> that systemd version v236+ supports direct logging
>> (StandardOutput:file:) to the custom log file by the service. I
>> would like to use that facility but we don't get the prefix that we used to
>> get when using the journal.
>>
>> Is there a way to prepare a custom patch locally to add the necessary
>> prefix to the stdout before writing to the custom log file? Is that a good
>> idea? Any other suggestions?
>>
>
> Probably not easily, as it's not systemd that is writing to the log file –
> it's your service process itself that directly gets a FD for the log file
> as its stdout. It's not specifically a "direct logging" feature, but rather
> just an equivalent to `myservice > log_file`.
>
> How do you currently get the logs "every few seconds"? Instead of repeated
> grabbing, have you tried using `journalctl --follow` to monitor logs
> continuously? This should use far less I/O than repeated `journalctl |
> tail` which is what it sounds like you're doing. (Wrap in `stdbuf -o0` if
> necessary.)
>
> Alternatively, set up the traditional rsyslogd or syslog-ng – writing to
> custom log files is basically what they *do*, and both of them are capable
> of receiving logs from journald (either by directly monitoring .journal
> files or by having the messages forwarded via socket).
>
> --
> Mantas Mikulėnas
>


Re: [systemd-devel] Prefix for direct logging

2021-09-27 Thread Mantas Mikulėnas
On Mon, Sep 27, 2021 at 1:11 PM Arjun D R  wrote:

> Hi Folks,
>
> Currently we are using systemd-journald for service logging. We run
> journalctl for a bunch of services and redirect those to the custom log
> files for every few seconds. This takes up the CPU for that particular
> time period since we have lot of IO operations as well. We came to know
> that systemd version v236+ supports direct logging
> (StandardOutput:file:) to the custom log file by the service. I
> would like to use that facility but we don't get the prefix that we used to
> get when using the journal.
>
> Is there a way to prepare a custom patch locally to add the necessary
> prefix to the stdout before writing to the custom log file? Is that a good
> idea? Any other suggestions?
>

Probably not easily, as it's not systemd that is writing to the log file –
it's your service process itself that directly gets a FD for the log file
as its stdout. It's not specifically a "direct logging" feature, but rather
just an equivalent to `myservice > log_file`.

How do you currently get the logs "every few seconds"? Instead of repeated
grabbing, have you tried using `journalctl --follow` to monitor logs
continuously? This should use far less I/O than repeated `journalctl |
tail` which is what it sounds like you're doing. (Wrap in `stdbuf -o0` if
necessary.)

Alternatively, set up the traditional rsyslogd or syslog-ng – writing to
custom log files is basically what they *do*, and both of them are capable
of receiving logs from journald (either by directly monitoring .journal
files or by having the messages forwarded via socket).

-- 
Mantas Mikulėnas


Re: [systemd-devel] fstab automount of a mdns samba share

2021-09-27 Thread François Cami
Hi,

On Mon, Sep 27, 2021 at 4:05 PM Julian Sikorski  wrote:
>
> Hi list,
>
> I am trying to set up an automount of my samba share. It works when I go
> by the IP address, i.e.
>
> //192.168.0.220/julian /mnt/openmediavaultcifs
> credentials=/home/julas/.credentials,uid=julas,gid=julas,vers=3.1.1,nobrl,auto
> 0 0

If this is in fstab, it's different from autofs/automount.
Try adding _netdev to mount options.

François

> but if I try to replace the IP address with odroidxu4.local, the mount
> will fail at boot. It appears that mdns is not working at the time the
> mount is attempted as running mount -a afterwards works just fine. What
> would be the proper way of setting this up? Thanks!
>
> Best regards,
> Julian
>



[systemd-devel] fstab automount of a mdns samba share

2021-09-27 Thread Julian Sikorski

Hi list,

I am trying to set up an automount of my samba share. It works when I go 
by the IP address, i.e.


//192.168.0.220/julian /mnt/openmediavaultcifs 
credentials=/home/julas/.credentials,uid=julas,gid=julas,vers=3.1.1,nobrl,auto 
0 0


but if I try to replace the IP address with odroidxu4.local, the mount 
will fail at boot. It appears that mdns is not working at the time the 
mount is attempted as running mount -a afterwards works just fine. What 
would be the proper way of setting this up? Thanks!


Best regards,
Julian



Re: [systemd-devel] Add LUKS disk to an Raspberry Pi 4 install

2021-09-27 Thread Lennart Poettering
gOn Sa, 25.09.21 17:47, Barry Scott (ba...@barrys-emacs.org) wrote:

> [I originally ask this question on the Fedora ARM list, but got no reply]
>
> I'm trying to build a RPi4 system that uses a LUKS encrypted disk.
>
> But I cannot get the volume to be unlocked when the system boots.
>
> I have installed Fedora-Minimal-34-1.2.aarch64.raw.xz to with
> arm-image-installer --target=rpi4 and that boots.
>
> Then I have added a new partition to that sdcard that I setup using this
> command on a Fedora 34 x86_86 system.
>
> cryptsetup \
>--type luks2 \
>--cipher xchacha20,aes-adiantum-plain64 \
>--hash sha256 \
>--iter-time 5000 \
>--pbkdf argon2i \
>luksFormat ${DEVICE}
>
> I got these settings from a blog on setting up LUKS for debian on raspberry
> pi.
>
> I add an entry to /etc/crypttab for the volume.
>
> When I boot the system I am not prompted for the password to unlock the
> volume as I was expecting.
>
> Looking in journalctl -b 0 I see these lines:
>
> Apr 06 01:01:36 clef.chelsea.private systemd[1]: dev-disk-
> by\x2duuid-8c2519ae\x2d78a9\x2d44b0\x2d871f\x2d0aa2422de03a.device: Job dev-
> disk-by\x2duuid-8c2519ae\x2d78a9\x2d44b0\x2d871f\x2d0aa2422de03a.device/start
> timed out.

This suggests that the backing device name you specified in
/etc/crypttab doesn't match reality. i..e here you specified a device
node by the UUID of what's on it. (Presumably that's supposed to be
the UUID of the LUKS2 superblock?) And it doesn't appear to match what
is *actually* the UUID of your LUKS2 superblock?

Lennart

--
Lennart Poettering, Berlin


[systemd-devel] Prefix for direct logging

2021-09-27 Thread Arjun D R
Hi Folks,

Currently we are using systemd-journald for service logging. We run
journalctl for a bunch of services and redirect those to the custom log
files for every few seconds. This takes up the CPU for that particular
time period since we have lot of IO operations as well. We came to know
that systemd version v236+ supports direct logging
(StandardOutput:file:) to the custom log file by the service. I
would like to use that facility but we don't get the prefix that we used to
get when using the journal.

Is there a way to prepare a custom patch locally to add the necessary
prefix to the stdout before writing to the custom log file? Is that a good
idea? Any other suggestions?

Thanks in advance for your help,
Arjun