<div dir="ltr">Hi Tibor,<div><br></div><div>Thanks for replying, I&#39;ll try and get my hands dirty with rust-cpython.</div><div><br></div><div>- As a user looking for a solution for correlating messages, Python as template language definitely makes a lot of sense. It allows us to offer a more complete solution - allowing user to write their own utilities while we can also provide a good helper library piggybacking on Rust.</div><div><br></div><div>- Whats you take on a generic script solution that takes context information as arguments, this allows user to use language of his choice. Is performance the only concern here? This shouldn&#39;t be very difficult to implement.</div><div><br></div><div>Are we expecting, users to still write python code (template) in JSON? It might get ugly defining functions within JSON. We could probably consider giving users config option to include their Python module.</div><div><br></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=aYWtzaGF5YXVyb3JhMjAwOEBnbWFpbC5jb20%3D&amp;type=zerocontent&amp;guid=245187be-db72-48a1-99ce-26e4ae3c267a"><font color="#ffffff" size="1">ᐧ</font></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 20, 2016 at 8:01 PM, Tibor Benke <span dir="ltr">&lt;<a href="mailto:ihrwein@gmail.com" target="_blank">ihrwein@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>See my answers inline.</div><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.8px">- While the reason to switch away from handlebars makes sense - Why do we want to using Python as templating language? What are some of the use cases, where Python could be beneficial over any other templating language?</span></div></div></blockquote><div><br></div></span><div>Users can freely write their own functions. We can provide some functions either in Rust or Python (it should be transparent to the users), but we can&#39;t cover everything. I know some people who would definitely write their own extensions.</div><div> </div><div>And the Python language is a way more powerfool tool than a simple templating language.</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.8px">- Are there any existing projects using Python as templating language? How is this going to be different than passing the context data to a Python script?</span></div></div></blockquote><div><br></div></span><div>Maybe the &quot;templating language&quot; term I used in the project description was a little bit ambigious. I&#39;d like to use Python as a general purpose language to process the context data and generate a new log message from it.</div><div><br></div><div>I think embedding Python (or Lua) into softwares written in other languages is quite common.<br></div><div><br></div><div>I&#39;d prefer this [0] library for the Rust &lt;-&gt; Python interaction. I used it for a side project [1], it&#39;s quite flexible and actively developed/maintained. You can check the examples in the documentation and the tests in the source code.</div><div><br></div><div>[0] <a href="https://github.com/dgrunwald/rust-cpython" target="_blank">https://github.com/dgrunwald/rust-cpython</a></div><div>[1] <a href="https://github.com/ihrwein/python-parser" target="_blank">https://github.com/ihrwein/python-parser</a></div><div><br></div><div>I&#39;d like to see the final solution to be &quot;composable&quot;. I mean, by providing small, reusable components users can compose the generated log message as they want. For example, the following line can generate a log message:</div><div><br></div><div>logmsg(ctx, &quot;context name is {<a href="http://context.name" target="_blank">context.name</a>}, max(foo)={max_foo}&quot;, foo=&quot;bar&quot;, quz=&quot;baz&quot;, max_foo=max(ctx, &quot;foo&quot;))<br></div><div><br></div><div>where ctx contains the context data, logmsg and max is a python/Rust function. The syntax isn&#39;t settled down :)</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div> </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.8px">- For the SQL-like syntax mentioned in project description - Can we design it as Python library using Rust via CFFI [0].</span></div></div></blockquote></span><div>see my previous answer</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.8px">I have filled the student application form.</span><span style="font-size:12.8px"> </span><span style="font-size:12.8px">I&#39;m already trying to understand the correlation library and playing around with existing tests. How can I get more involved and better understand the requirements of the project?</span></div></div></blockquote><div><br></div></span><div>First, I&#39;d check what information is available in the contexts (your context data): <a href="https://github.com/ihrwein/correlation/blob/master/src/config/action/message/renderer_context.rs#L36-L48" target="_blank">https://github.com/ihrwein/correlation/blob/master/src/config/action/message/renderer_context.rs#L36-L48</a><br></div><div><br></div><div>You you can use {{context_len}} to get the number of messages in the context, etc...<br></div><div><br></div><div>IMHO the hardest part is using the [0] libray. It&#39;s well designed, but if you are new to Rust you may find it difficult to use. So I&#39;d try that first. I don&#39;t know about any bugs in the correlation library, but you may try to refactor some code (just to see the internals).</div><div><br></div><div>The requirements are listed in the idea page as &quot;Tasks&quot;.</div><div><br></div><div>BR,</div><div>Tibor</div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>
<br>______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" rel="noreferrer" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" rel="noreferrer" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">- Akshay Aurora<br><br></div>
</div>