<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 2, 2017 at 11:15 AM, Bogdan Dobrelya <span dir="ltr"><<a href="mailto:bdobreli@redhat.com" target="_blank">bdobreli@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi. Few comments inline.<div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Stackers,<br>
While working on my locally deployed Openstack (Pike using TripleO), I<br>
was a bit struggling with the logging part. Currently, all logs are<br>
pushed to per-service files, in the standard format "one line per<br>
entry", plain flat text.<br>
<br>
It's nice, but if one is wanting to push and index those logs in an ELK,<br>
the current, default format isn't really good.<br>
<br>
After some discussions about oslo.log, it appears it provides a nice<br>
JSONFormatter handler¹ one might want to use for each (python) service<br>
using oslo central library.<br>
<br>
A JSON format is really cool, as it's easy to parse for machines, and it<br>
can be on a multi-line without any bit issue - this is especially<br>
important for stack traces, as their output is multi-line without real<br>
way to have a common delimiter so that we can re-format it and feed it<br>
to any log parser (logstash, fluentd, …).<br>
<br>
After some more talks, olso.log will not provide a unified interface in<br>
order to output all received logs as JSON - this makes sens, as that<br>
would mean "rewrite almost all the python logging management<br>
interface"², and that's pretty useless, since (all?) services have their<br>
own "logging.conf" file.<br>
<br>
That said… to the main purpose of that mail:<br>
<br>
- Default format for logs<br>
A first question would be "are we all OK with the default output format"<br>
- I'm pretty sure "humans" are happy with that, as it's really<br>
convenient to read and grep. But on a "standard" Openstack deploy, I'm<br>
pretty sure one does not have only one controller, one ceph node and one<br>
compute. Hence comes the log centralization, and with that, the log<br>
indexation and treatments.<br>
<br>
For that, one might argue "I'm using plain files on my logger, and<br>
grep-ing -r in them". That's a way to do things, and for that, plain,<br>
flat logs are great.<br>
<br>
But… I'm pretty sure I'm not the only one wanting to use some kind of<br>
ELK cluster for that kind of purpose. So the right question is: what<br>
about switching the default log format to JSON? On my part, I don't see<br>
"cons", only "pros", but my judgment is of course biased, as I'm "alone<br>
in my corner". But what about you, Community?<br>
<br>
- Provide a way to configure the output format/handler<br>
While poking around in the puppet modules code, I didn't find any way to<br>
set the output handler for the logs. For example, in puppet-nova³ we can<br>
set a lot of things, but not the useful handler for the output.<br></blockquote></div></div></blockquote><div> </div><div>Right, I was also looking into this and am yet to find how it's done. Any idea how?<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
It would be really cool to get, for each puppet module, the capability<br>
to set the handler so that one can just push some stuff in hiera, and<br>
Voilà, we have JSON logs.<br>
<br>
Doing so would allow people to chose between the default (current)<br>
output, and something more "computable".<br>
</blockquote>
<br></div></div>
This is being implemented (for Q) in the scope of this blueprint [0].<br>
By default, containers will keep the current logging behaviour, which is writing logs into bind-mounted host-path directories, and for those services that can syslog only, sending the logs to the host journald via syslog (bind-mounted /dev/log). And if the stdout/stderr feature enabled, side-car containers will make sure everything is captured in journald and tagged properly, with multiline entries as well. And journald can dump messages as JSON as well. I hope that works! Please send you comments to the aforementioned bp's spec.<br>
<br>
[0] <a href="https://blueprints.launchpad.net/tripleo/+spec/logging-stdout-rsyslog" rel="noreferrer" target="_blank">https://blueprints.launchpad.n<wbr>et/tripleo/+spec/logging-stdou<wbr>t-rsyslog</a></blockquote><div>Correct, as Bogdan mentioned, that will hopefully come as part of the work of that blueprint. The plan so far is to keep the logs as they currently are and then put them in JSON format in an rsyslog forwarder (the implementation is still to come).</div><div><br></div><div>However, one thing that would be great would be to have oslo.log already provide JSON output, that way we would need way less processing. And most importantly, it would make StackTrace processing easier. Right now it's a pain to reconstruct python exceptions as they end up being forwarded as several log lines, and having it as one line, or as JSON output already would be great. Any idea if this is possible already via oslo.log?<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Of course, either proposal will require a nice code change in all puppet<br>
modules (add a new parameter for the foo::logging class, and use that<br>
new param in the configuration file, and so on), but at least people<br>
will be able to actually chose.<br>
<br>
So, before opening an issue on each launchpad project (that would be…<br>
long), I'd rather open the discussion in here and, eventually, come to<br>
some nice, acceptable and accepted solution that would make the<br>
Openstack Community happy :).<br>
<br>
Any thoughts?<br>
<br>
Thank you for your attention, feedback and wonderful support for that<br>
monster project :).<br>
<br>
Cheers,<br>
<br>
C.<br>
<br>
<br>
¹<br>
<a href="https://github.com/openstack/oslo.log/blob/master/oslo_log/formatters.py#L166-L235" rel="noreferrer" target="_blank">https://github.com/openstack/o<wbr>slo.log/blob/master/oslo_log/f<wbr>ormatters.py#L166-L235</a><br>
²<br>
<a href="http://eavesdrop.openstack.org/irclogs/%23openstack-oslo/%23openstack-oslo.2017-11-01.log.html#t2017-11-01T13:23:14" rel="noreferrer" target="_blank">http://eavesdrop.openstack.org<wbr>/irclogs/%23openstack-oslo/%<wbr>23openstack-oslo.2017-11-01.lo<wbr>g.html#t2017-11-01T13:23:14</a><br>
³ <a href="https://github.com/openstack/puppet-nova/blob/master/manifests/logging.pp" rel="noreferrer" target="_blank">https://github.com/openstack/p<wbr>uppet-nova/blob/master/manifes<wbr>ts/logging.pp</a><br>
<br>
<br>
-- <br>
Cédric Jeanneret<br>
Senior Linux System Administrator<br>
Infrastructure Solutions<br>
<br>
Camptocamp SA<br>
PSE-A / EPFL, 1015 Lausanne<br>
<br>
Phone: <a href="tel:%2B41%2021%20619%2010%2032" value="+41216191032" target="_blank">+41 21 619 10 32</a><br>
Office: <a href="tel:%2B41%2021%20619%2010%2002" value="+41216191002" target="_blank">+41 21 619 10 02</a><br>
Email: <a href="mailto:cedric.jeanneret@camptocamp.com" target="_blank">cedric.jeanneret@camptocamp.co<wbr>m</a><br>
<br>
<br>
<br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Best regards,<br>
Bogdan Dobrelya,<br>
Irc #bogdando<br>
<br>
______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.op<wbr>enstack.org?subject:unsubscrib<wbr>e</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k-dev</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font style="font-family:arial narrow,sans-serif;color:rgb(102,102,102)" size="2">Juan Antonio Osorio R.<br>e-mail: <a href="mailto:jaosorior@gmail.com" target="_blank">jaosorior@gmail.com</a><br></font><font style="font-family:arial narrow,sans-serif;color:rgb(102,102,102)" size="2"><br></font></div></div></div>
</div></div>