Always, it is by design as described in the docs for decode_message:
https://hekad.readthedocs.org/en/latest/sandbox/index.html


   - message (table) The array based version of the message structure with
   the value member always being an array (even if there is only a single
   item). This format makes working with the output more consistent. The wide
   variation in the inject table format is to ease the construction of the
   message especially when using an LPeg grammar transformation.

Trink

On Wed, Oct 7, 2015 at 7:04 AM, Timur Batyrshin <ert...@gmail.com> wrote:

> Hi,
>
> I’ve got a question about decoding of Heka messages.
> Suppose the following call:
> msg = decode_message(read_message("raw"))
>
> Here msg.Fields will hold a table of values like the following:
> {
>  “name”: “foobar”,
>  “type”: “string”,
>  “value”: 123
> }
>
> What is very much unclear to me is why *some* of the fields here are
> produced not as plain values but as a table holding a single value, like
> {
>  “name”: “foobar”,
>  “value”: [123]
> }
>
> This way I need every time to check for if the value is an array or not,
> an example from yourselves:
> https://github.com/mozilla-services/heka/blob/versions/0.10/sandbox/lua/modules/ts_line_protocol.lua#L161-L162
>
>
> When does this condition occur?
>
> Thanks,
> Timur
>
> _______________________________________________
> 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