opensearch-project / OpenSearch-Dashboards

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

[BUG] #7964

Open ravi96b opened 2 months ago

ravi96b commented 2 months ago

Describe the bug

Display logs in UTC instead of Browser time. In the current OFD logging stack is there any way to change the timezone to default UTC in code level as whenever we run the cluster setup job(basically will reatrt the opensearch) the OpenSearch dashboard timezone is selected as browser. Then we need to manually change the timezone to UTC which will be persisted only till the next cluster setup job.

Can we add this feature into the OFD logging stack?.

Actually, I also wanted to understand if there is a way to achieve this through configuration files, or if it can only be done via the UI?

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

OpenSearch Version Please list the version of OpenSearch being used.

Dashboards Version Please list the version of OpenSearch Dashboards being used.

Plugins

Please list all plugins currently enabled.

Screenshots

If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

Additional context

Add any other context about the problem here.

CCongWang commented 1 month ago

Hi @ravi96b could you please provide more info? like which OFD versions you are using? screenshots will be helpful, thanks!

ravi96b commented 1 month ago

Hi @CCongWang ,

The OFD version using v 2.7.0 .

Timezone for date formatting is the parameter which i want make changes , i want to persist the timezone to always to UTC . For now as am aware the only option is from UI , but after every restart it changes back to browser time zone.

{DEA59B0D-49AE-4863-B4B4-8F87A016E7F2} {B29FFB72-5F49-4D11-ACE8-C5BF8C27424B}
ravi96b commented 3 weeks ago

Hi @CCongWang / Colleagues,

Any update?.

Regards, Ravi

Hailong-am commented 3 weeks ago

i want to persist the timezone to always to UTC . For now as am aware the only option is from UI , but after every restart it changes back to browser time zone.

@ravi96b after you made the change, can you do a additional check with dev tools for below request? make sure "dateFormat:tz": "UTC" exist in the search result.

GET .kibana/_search
{
  "query": {
    "term": {
      "type": {
        "value": "config"
      }
    }
  }
}

An example response

{
        "_index": ".kibana_4",
        "_id": "config:3.0.0",
        "_score": 3.7711172,
        "_source": {
          "config": {
             ...
            "dateFormat:tz": "UTC"
          },
          "type": "config",
          "references": [],
          "migrationVersion": {
            "config": "7.9.0"
          },
          "updated_at": "2024-10-15T10:05:53.211Z"
        }
      }
ravi96b commented 3 weeks ago

Hi @Hailong-am

The purpose is not validation; instead of making the changes every time from the OpenSearch dashboard (UI), we want to persist the change to dateFormat: "UTC". Therefore, we request guidance on how to achieve this in the configuration files.

Because the changes get reverted back to dateFormat:"browser time" after ofd restart .

Hailong-am commented 3 weeks ago

Hi @Hailong-am

The purpose is not validation; instead of making the changes every time from the OpenSearch dashboard (UI), we want to persist the change to dateFormat: "UTC". Therefore, we request guidance on how to achieve this in the configuration files.

Because the changes get reverted back to dateFormat:"browser time" after ofd restart .

I see, try this in your opensearch_dashboards.yml file, that will make it fixed as UTC and not able to change via UI.

uiSettings:
  overrides:
    "dateFormat:tz": "UTC"

image