opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.65k stars 863 forks source link

[BUG] Maximum upload size for saved objects cannot exceed 1MB #1166

Open rkbennett opened 2 years ago

rkbennett commented 2 years ago

Describe the bug

When importing saved objects from a file, files larger than 1MB result in an HTTP- 413 (request entity too large), trying both the savedObjects.maxImportPayloadBytes and server.maxPayloadBytes settings doesn't appear to change the size limit

To Reproduce Steps to reproduce the behavior: Deploy opensearch dashboard with docker, attempt to import a saved object file larger than 1MB via the REST API

Expected behavior Either savedObjects.maxImportPayloadBytes or server.maxPayloadBytes should raise the request size limit, or the default should be higher than 1MB

OpenSearch Version 1.2.3

Dashboards Version 1.2.0

Plugins

alertingDashboards,usageCollection,opensearchDashboardsUsageCollection,opensearchDashboardsLegacy,mapsLegacy,share,opensearchUiShared,legacyExport,embeddable,expressions,data,home,console,apmOss,management,indexPatternManagement,advancedSettings,savedObjects,securityDashboards,reportsDashboards,indexManagementDashboards,anomalyDetectionDashboards,dashboard,visualizations,visTypeVega,visTypeTimeline,timeline,visTypeTable,visTypeMarkdown,tileMap,regionMap,inputControlVis,ganttChartDashboards,visualize,queryWorkbenchDashboards,charts,visTypeVislib,visTypeTimeseries,visTypeTagcloud,visTypeMetric,observabilityDashboards,discover,savedObjectsManagement,bfetch

Host/Environment (please complete the following information):

kavilla commented 2 years ago

Hello @rkbennett, thanks for opening this!

Would you mind sharing your Dockerfile and/or docker-compose file on how you are deploying OpenSearch Dashboards? If not, how are you setting this configuration? Do you have a local opensearch_dashboards.yml file that you are passing to your container on start. Something like this: https://opensearch.org/docs/latest/opensearch/install/docker#configure-opensearch

rkbennett commented 2 years ago

I'm technically running it on k8s, but yes, I'm mounting in a opensearch_dashboards.yml via a configmap I'll try and get the config file here in a bit, but I had removed those settings sense they didn't seem to do anything.

rkbennett commented 2 years ago

server.host: "0" opensearch.ssl.verificationMode: none opensearch.requestHeadersWhitelist: [ authorization,securitytenant,security_tenant ] opensearch_security.multitenancy.enabled: true opensearch_security.multitenancy.tenants.preferred: ["Global"] opensearch_security.readonly_mode.roles: ["kibana_read_only"] opensearch_security.cookie.secure: true home.disableWelcomeScreen: true map.tilemap.url: "https://some.tms.com/tile/{z}/{x}/{y}.png" map.includeElasticMapsService: false savedObjects.maxImportPayloadBytes: 104857600 server.maxPayloadBytes: 104857600

kavilla commented 2 years ago

Apologies about the delay on this. Still looking into this.

btarrh commented 1 year ago

When attempting to import a saved object into OpenSearch Dashboards I was receiving the error "Request Entity Too Large". The file size was 1,214KB. I found that the issue was not in OpenSearch Dashboards but in Nginx.

Edit the Nginx configuration: vim /etc/nginx/nginx.conf

Add the following line to the http context to increase the size limit. Adjust size limit accordingly. client_max_body_size 2M;

Restart the Nginx service: systemctl restart nginx

Strayfe commented 2 months ago

Just adding my two pence here; I think this is a non-issue.

I have just recently come across the 413: Request Entity Too Large error in the observability stack due to the page trying to send a very large set of predicates to the server which ended up being over 1MB in size.

The fix for this was two-fold:

1. Implement a larger body limit in nginx As mentioned by @btarrh this can be set manually on any nginx implementation via client_max_body_size or if you are using the nginx-ingress in k8s then the corresponding setting would be proxy-body-size (at the time of writing this).

kind: ConfigMap
apiVersion: v1
  name: ingress-nginx-controller
  namespace: ingress-nginx
data:
  proxy-body-size: "10m"
  ...

2. Increase the dashboards max payload size

apiVersion: opensearch.opster.io/v1
kind: OpenSearchCluster
metadata:
  name: opensearch-cluster
  namespace: opensearch
spec:
  dashboards:
    additionalConfig:
      server.maxPayloadBytes: "10485760"
      ...

Note that the value needs to be wrapped in quotes which is why the OP may have not been able to get this working initially.

I just updated these two settings myself and managed to get my observability plugin to start showing me the traces and graphs again.

I know that my scenario is not exactly the same as OP, but looking at the configuration in response to this thread makes me believe it was likely a parsing issue with quotes.