Bytes value wraps to negative value

Hello,

Am attempting to multiply the number of bytes from netflow by 100. This is to offset the sampling rate.

The pipeline has the following script:

  {
    "script": {
      "source": "ctx.network.true_bytes2 = ctx.source.bytes * 100;"
    }
  },

Both fields are long's so A signed 64-bit integer. Which should allow me more then enough room to store this data usage. However I can see that the true_bytes seems to be wraping ( overflowing and starting at minus value).


The results are fine under the 20MB. I am truly at a loss what could be the cause of this issue.

Issue seems to be solved when defining the variable as a long.

Why you need to cast a long to a long when it already is a long dunno. But it solved the issue.

"script": {
  "source": "long bytes = ctx.source.bytes;\r\nctx.network.true_bytes = bytes * 100;"
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.