Thanks a lot Mantas.
But in my sytem, logger does not have "--journal".
Are you aware of other tools from bash which can be used?
BR
发件人: Mantas Mikulėnas <grawity@xxxxxxxxx>
发送时间: 2021年10月22日 18:45 收件人: DHAIY DHAIY <dhaiy@xxxxxxx> 抄送: systemd-devel@xxxxxxxxxxxxxxxxxxxxx <systemd-devel@xxxxxxxxxxxxxxxxxxxxx> 主题: Re: [systemd-devel] 回复: Is it possible to send a string to the journal of one specific systemd unit If you have root privileges (i.e. UID 0), then yes, you can send a journal message with the "OBJECT_SYSTEMD_UNIT=myservice.service" field and journalctl will automatically look for that.
In C, specify the field when calling sd_journal_sendv(); in bash you can use `logger --journal`:
(echo "OBJECT_SYSTEMD_UNIT=sshd.service";
echo "MESSAGE=Hello world!") | sudo logger --journal On Fri, Oct 22, 2021 at 11:43 AM DHAIY DHAIY <dhaiy@xxxxxxx> wrote:
Mantas Mikulėnas
|