<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Mantas,<br>
<br>
I do not want to reimplement all the logic myself, I just want to
get journal entries directly at the source. The syscall you listed
will do nicely, thank you, provided it supplies the right inode
everytime my process is awakened by inotify. I will test it in the
next hours/days.<br>
<br>
Thanks again for this precious insight.<br>
<br>
giulix<br>
<br>
<div class="moz-cite-prefix">On 08/14/2015 01:56 PM, Mantas
Mikulėnas wrote:<br>
</div>
<blockquote
cite="mid:CAPWNY8U=J-Du1vjLp5JyBY-OXcuVSnjyA0F1yx_FnOkc7nnyOQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Fri, Aug 14, 2015 at 2:20 PM,
giulix <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:giulio.martinat@gmail.com" target="_blank">giulio.martinat@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I have a process that reads from the journald log file. It
gets a notification from inotify that something's changed,
opens the journal, skims through it for messages it's
interested in, does its stuff and closes the journal file
(<a moz-do-not-send="true"
href="http://www.giulix.it/content/extracting-data-systemd-journal-programmatically"
rel="noreferrer" target="_blank">http://www.giulix.it/content/extracting-data-systemd-journal-programmatically</a>).<br>
When the journal log file is rotated, the process stops to
do its job. It is, of course, because it never realizes
the file it's waiting on for notifications via inotify has
changed.<br>
I have uselessly tried to implement some mechanism to have
my process restarted when the journal file changes, but it
seems that nothing is available from systemd or journald
to notify a process that journald is switching to a new
output file.<br>
</blockquote>
<div><br>
</div>
<div>There is no need for a signal – inotify can inform you
about renames as well.</div>
<div><br>
</div>
<div>But, you shouldn't reimplement the entire logic
yourself. (There's more to it, like separate systemd or
user journals....) <b>Instead, call sd_journal_get_fd(3)
and let libsystemd do the monitoring.</b></div>
</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">Mantas Mikulėnas <<a
moz-do-not-send="true" href="mailto:grawity@gmail.com"
target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:grawity@gmail.com">grawity@gmail.com</a></a>></div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>