Decision log limit question #332
-
Hi,
So I tried to limit the decision log size limit by 1MB. Though I realized that the decision log service (which has a size limit of 2MB just to be on the safe side) started throwing errors about the payload size being exceeded. So it seems that the agent (v0.48.0) does not respect this setting for some reason. Have I configured something wrong? Or what should be the expected behaviour when the size limit is exceeded on opa side? |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 4 replies
-
Hi Sirpi, thanks for your question. Would you be able to share the discovery configuration you're using with this. e.g. discovery:
resource: bundles/discovery.tar.gz
decision: discovery/config
... |
Beta Was this translation helpful? Give feedback.
-
Hi, The base config has this structure:
I hope you find something useful here and thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
@sirpi what is the exact error message you get? If the size of a decision log event exceeds the specified value for the |
Beta Was this translation helpful? Give feedback.
-
There are policies whose response are organized and filtered data and it can be larger than the limit of 1MB.
The limit mentioned here is twice as much as the one set in the opa server. Btw, what should opa do if the threshold is reached? Sending the response in chunks? Or trimming the response? Or not sending anything? I did not find the intended behaviour in the docs for this case. And thanks @charlieegan3 for your repo, I'll check it tomorrow. Now it's getting late :) |
Beta Was this translation helpful? Give feedback.
-
Can you share the actual OPA log? In your case a single event could be exceeding the |
Beta Was this translation helpful? Give feedback.
-
Here is the OPA error log:
And yes, sometimes the decision log can be larger than the limit for a single request. Does that mean that in this case the whole decision log is sent to the decision-log-service without any control of the limit? |
Beta Was this translation helpful? Give feedback.
-
This seems to be an issue with the server. Here OPA is trying to upload the log but the server is not able to accept it. You'll likely need to check the server code. OPA will simply try to resend the logs. |
Beta Was this translation helpful? Give feedback.
-
So what I would like to achieve is not getting an error if there is a single large decision log in the system. With this configuration it is strange for me that the server gets a log which is larger than configured 2MB. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help and for the repo you created. It indeed works as intended. Now I have to figure out why my opa server behaves differently. |
Beta Was this translation helpful? Give feedback.
-
Just before closing the issue, it was indeed a mistake on the decision log server side. This setting caused the problem:
So the 2MB was not a hard limit on the request side, but the max memory usage for JSON transformation. And that sometimes required more than 2MB of memory for a request less than 1MB. Sorry for the inconvenience. But at least now I understand the behaviour of the "upload_size_limit_bytes" parameter, thanks for your help and clarification. |
Beta Was this translation helpful? Give feedback.
So what I would like to achieve is not getting an error if there is a single large decision log in the system.
My agent is configured to limit the decision size in 1MB.
My decision log server is configured to only accept logs smaller than 2MB.
With this configuration it is strange for me that the server gets a log which is larger than configured 2MB.
Now I understand why this happens based on the implementation.
But probably it would be more useful to replace the result in the decision log with something like { "result" : "LARGE OBJECT!" } or something like that instead of getting an error. I wouldn't like to increase the limits to avoid sending large objects through the network but it se…