<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Because of the documentation for the 'logsdirectory' option for unit files.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html" id="LPlnk586738">https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html</a></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<dt><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>RuntimeDirectory=</code>,
<code>StateDirectory=</code>, <code>CacheDirectory=</code>, <code>LogsDirectory=</code>,
<code>ConfigurationDirectory=</code></span></dt><dd>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
These options take a whitespace-separated list of directory names. The specified directory names must be relative, and may not include "<code>..</code>". If set, when the unit is started, one or more directories by the specified names will be created (including
 their parents) below the locations defined in the following table. Also, the corresponding environment variable will be defined with the full paths of the directories. If multiple directories are set, then in the environment variable the paths are concatenated
 with colon ("<code>:</code>").</div>
<div style="margin-top: 1em; margin-bottom: 1em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Table 2. Automatic directory creation and environment variables</b></div>
<table summary="Automatic directory creation and environment variables">
<tbody>
<tr>
<th><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Directory</span></th>
<th><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Below path for system units</span></th>
<th><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Below path for user units</span></th>
<th><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Environment variable set</span></th>
</tr>
<tr>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>RuntimeDirectory=</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>/run/</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$XDG_RUNTIME_DIR</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$RUNTIME_DIRECTORY</code></span></td>
</tr>
<tr>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>StateDirectory=</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>/var/lib/</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$XDG_STATE_HOME</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$STATE_DIRECTORY</code></span></td>
</tr>
<tr>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>CacheDirectory=</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>/var/cache/</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$XDG_CACHE_HOME</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$CACHE_DIRECTORY</code></span></td>
</tr>
<tr>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>LogsDirectory=</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>/var/log/</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$XDG_STATE_HOME/log/</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$LOGS_DIRECTORY</code></span></td>
</tr>
<tr>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>ConfigurationDirectory=</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>/etc/</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$XDG_CONFIG_HOME</code></span></td>
<td><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code>$CONFIGURATION_DIRECTORY</code></span></td>
</tr>
</tbody>
</table>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Granted...this states the directory will be created in the case of user units...and does not state that it would actually put the log there. But it doesn't make a lot of sense to state the given behavior and not use it</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Andrei Borzenkov <arvidjaar@gmail.com><br>
<b>Sent:</b> Monday, August 12, 2024 11:08 PM<br>
<b>To:</b> SCOTT FIELDS <Scott.Fields@kyndryl.com>; systemd-devel@lists.freedesktop.org <systemd-devel@lists.freedesktop.org><br>
<b>Subject:</b> [EXTERNAL] Re: [systemd-devel] Trying to resolve user level systemd unit journal not writing to local user journal</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 12.08.2024 22:36, SCOTT FIELDS wrote:<br>
> OS = Fedora 39<br>
> Systemd version = 254.13<br>
> <br>
> I have an application running via a user level system unit file.<br>
> <br>
> The UID is > 999.<br>
> <br>
> I'm expecting the application journal entries to be a local entry in $XDG_STATE_HOME/log, but it's using the user level journal in /var/log/journal.<br>
> <br>
<br>
Why do you expecting that?<br>
<br>
> FYI, I'm not expressly setting XDG_STATE_HOME, since it heavily implies it will default to '$HOME /. local/state'<br>
> <br>
> I not yet tested expressly setting XDG_STATE_HOME in the unit file environment variables, since I really shouldn't have to.<br>
> <br>
> My understanding of the behavior is it SHOULD be writing this to the XDG_STATE_HOME location. If it's correct, how I can be troubleshoot why it's not?<br>
> <br>
> <br>
> Scott Fields<br>
> <br>
> Kyndryl<br>
> <br>
> Senior Lead SRE – BNSF<br>
> <br>
> 817-593-5038 (BNSF)<br>
> <br>
> scott.fields@kyndryl.com<mailto:scott.fields@kyndryl.com><br>
> <br>
> scott.fields@bnsf.com<mailto:scott.fields@bnsf.com><br>
> <br>
> <br>
> <br>
<br>
</div>
</span></font></div>
</dd></body>
</html>