<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Perhaps the symbolic link name can also
permit macros, so for a destination that is partially time based
and host/program based you can have a specific symlink.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">For example:</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Destination name
$HOST.$YEAR.$MONTH.$DAY.$HOUR</div>
<div class="moz-cite-prefix">Symblic link $HOST.latest</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Just thinking out loud.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Evan<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 2021-12-05 08:49, Gabor Nagy (gnagy)
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CO6PR19MB5387395F85E773B2015A69E1816C9@CO6PR19MB5387.namprd19.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
Hello Andrea!<br>
<br>
Thank you for your contribution! We always welcome feedback
and contribution from the community!<br>
<br>
I've quickly checked your patch, and it looks good. Maybe
minor things could be changed, but we will see this during a
thorough review.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
We integrate patches via pull requests on GitHub. [1]</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
How would you like to continue this contribution?<br>
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial,
Helvetica, sans-serif; font-size: 11pt;">Would you like to
open a pull request on GitHub?</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<span style="background-color:rgb(255, 255,
255);display:inline !important">I see a corner case of the
feature: if the filename template is not time-based, like
e.g. $PROGRAM or $HOST, it can happen that the symlink is
changed several times in a short time.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<span style="background-color:rgb(255, 255,
255);display:inline !important">This is not an argument
against the feature, it's just a behaviour that should be
considered and documented.</span><br>
As I see, the feature in general creates a symlink with the
name given in "symlink_as" option when a new file is opened.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
In other words: the configured symlink always points to the
latest file that were opened.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
Best Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
Gábor</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
[1] <a href="https://github.com/syslog-ng/syslog-ng"
moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/syslog-ng/syslog-ng</a></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b>
syslog-ng <a class="moz-txt-link-rfc2396E" href="mailto:syslog-ng-bounces@lists.balabit.hu"><syslog-ng-bounces@lists.balabit.hu></a> on
behalf of <a class="moz-txt-link-abbreviated" href="mailto:a.biardi@tiscali.it">a.biardi@tiscali.it</a> <a class="moz-txt-link-rfc2396E" href="mailto:a.biardi@tiscali.it"><a.biardi@tiscali.it></a><br>
<b>Sent:</b> Saturday, December 4, 2021 15:29<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>
<a class="moz-txt-link-rfc2396E" href="mailto:syslog-ng@lists.balabit.hu"><syslog-ng@lists.balabit.hu></a><br>
<b>Subject:</b> [syslog-ng] [patch] new feature for file
destination: persistent symlinks</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span
style="font-size:11pt;">
<div class="PlainText">CAUTION: This email originated from
outside of the organization. Do not follow guidance,
click links, or open attachments unless you recognize
the sender and know the content is safe.<br>
<br>
<br>
Hi all,<br>
<br>
I'm new here. I love syslog-ng: it's well written and
documented and<br>
each time I need some new feature, I dig up the
documentation and I<br>
find it's already implemented!<br>
<br>
Like many others, I use macros in file destinations
(say,<br>
"/var/log/cron.${YEAR}${MONTH}"), but I also want to
maintain a<br>
persistent symlink to the current logfile (that would be<br>
something like "/var/log/cron") in order to have
"easier" access if I'm<br>
grepping for something manually.<br>
<br>
I couldn't find this feature in syslog-ng, so I wrote
the code myself;<br>
in the configuration file, it looks like this:<br>
<br>
destination d_file_cron {<br>
file("/var/log/cron.${YEAR}${MONTH}"
symlink_as("/var/log/cron"));<br>
};<br>
<br>
It works for me on my Slackware boxes. I'm sharing the
patch I put<br>
together, hoping that it may be useful to others and
perhaps even<br>
considered for inclusion in mainstream.<br>
<br>
From a functional perspective, the "symlink_as" file
inherits both<br>
"create-dirs" and file ownership from its file
destination (permissions<br>
are not applicable to symlinks, at least on linux).<br>
<br>
Patch applies cleanly to latest production release
(3.33). I tried to<br>
keep the original coding style for easier review
(admittedly, the code<br>
could have gone into the function that opens the file
destination, but<br>
I didn't want to change too much).<br>
<br>
Thanks for the good work and happy logging!<br>
<br>
Andrea.<br>
</div>
</span></font></div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">______________________________________________________________________________
Member info: <a class="moz-txt-link-freetext" href="https://lists.balabit.hu/mailman/listinfo/syslog-ng">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a>
Documentation: <a class="moz-txt-link-freetext" href="http://www.balabit.com/support/documentation/?product=syslog-ng">http://www.balabit.com/support/documentation/?product=syslog-ng</a>
FAQ: <a class="moz-txt-link-freetext" href="http://www.balabit.com/wiki/syslog-ng-faq">http://www.balabit.com/wiki/syslog-ng-faq</a>
</pre>
</blockquote>
</body>
</html>