If they really need to be text I would use cjson.encode/decode.  However,
for your use case I would recommend writing the messages out as a Heka
protobuf stream and using heka-cat to get at the text representation when
you need to.

Trink

On Mon, Feb 16, 2015 at 1:05 AM, Djamel F. <djamel...@gmail.com> wrote:

> Here is my use case:
> I want to serialize (lua sandbox encoder) the messages flowing through
> heka to some readable log files which are sent to a remote server. The
> remote server also runs a global heka instance which parses (lua sandbox
> decoder) the log files coming from many sources. I know that Heka is able
> to forward the messages directly to remote heka instances through TCP, but
> I also use the log files for archiving data, so I would rather not use the
> TCP forwarding feature for now.
>
> I want the format of the log files to be pure text and to contains one
> message per line (so that we can easily use unix tools like grep), that is
> why my encoder escapes carriage returns and other special chars with
> string.format("%q", "<my string to escape>")
>
> I hope this clears up my use case.
> What are the other ways of decoding escaped strings you were referring to?
>
> Thanks.
>
>
>
> On 13 February 2015 at 20:04, Michael Trinkala <mtrink...@mozilla.com>
> wrote:
>
>> loadstring is disallowed in the sandbox and that is unlikely to change.
>>
>> There are other ways of decoding it but before we go there what is your
>> use case for creating a string suitable to load into the Lua interpreter?
>> BTW: raw strings will work properly in a Heka message as-is.
>>
>> On Fri, Feb 13, 2015 at 2:46 AM, Djamel F. <djamel...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm working on a lua sandbox encoder & decoder to dump or load a raw
>>> string.
>>> So I'm using string.format("%q", "<my string to escape>") to escape any
>>> special chars in the encoding process.
>>> And now I want to do is the opposite in the decoder, I mean unescape the
>>> string.
>>> So I tried to use the "loadstring" function but it seems heka's lua
>>> sandbox don't know this function.
>>>
>>> Do you know if the "loadstring" lua function is supported? Any other
>>> idea to unescape a string without using the "loadstring" function?
>>> Thanks.
>>>
>>> _______________________________________________
>>> Heka mailing list
>>> Heka@mozilla.org
>>> https://mail.mozilla.org/listinfo/heka
>>>
>>>
>>
>
_______________________________________________
Heka mailing list
Heka@mozilla.org
https://mail.mozilla.org/listinfo/heka

Reply via email to