Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kibana URL field in index-pattern with relative URL stores the base URL at creation time in the saved object #63924

Closed
lucabelluccini opened this issue Apr 18, 2020 · 10 comments · Fixed by ukncsc/lme#70
Assignees
Labels
bug Fixes for quality problems that affect the customer experience discuss Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:FieldFormatters impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort v7.6.0 v7.7.0 v7.8.0 v7.9.0 v7.10.0

Comments

@lucabelluccini
Copy link
Contributor

Kibana version: 7.6.0

Describe the bug:

Relative URLs keep parsedUrl / origin generated at the time of the creation of the index-pattern.

Steps to reproduce:

On a Kibana instance located at https://localhost:5601:

  1. Add the sample data (any kind)
  2. Go to the index-pattern settings
  3. Edit one of the text field to be formatted as Url and specify a relative URL (e.g. /some/file.png)
  4. Save
  5. Snapshot the .kibana* indices
    On another cluster (e.g. another environment), with Kibana instance located at https://dev.comp.com:5601 (server.host: dev.comp.com in kibana.yml):
  6. Restore the .kibana* indices
  7. All works fine, except the the fact the field edited on step (3) will still point to https://localhost:5601

Expected behavior:

The "base" URL should not be stored in the index-pattern.

Provide logs and/or server output (if relevant):

GET .kibana/_doc/index-pattern:90943e30-9a47-11e8-b64d-95841ca0b247?filter_path=_source.index-pattern.fieldFormatMap
# Response
{
  "_source" : {
    "index-pattern" : {
      "fieldFormatMap" : """{"url.keyword":{"id":"url","params":{"parsedUrl":{"origin":"https://localhost:5601","pathname":"/app/kibana","basePath":""},"urlTemplate":"/some/param.png"}},"url":{"id":"url","params":{"parsedUrl":{"origin":"https://localhost:5601","pathname":"/app/kibana","basePath":""},"urlTemplate":"/some/param.png"}}}"""
    }
  }
}

Any additional context:

From our Discuss forum https://discuss.elastic.co/t/kibana-url-template-with-relative-path/228418/5

Workaround:

One of the following applies:

  1. Patch the Kibana object by import / export
  2. Patch the Kibana index-pattern object in the .kibana index
  3. Edit the index-pattern, switch to the default type, save, then add the Url type back
@lucabelluccini lucabelluccini changed the title Kibana URL field in index-pattern relative URL store the base URL at creation time Kibana URL field in index-pattern with relative URL stores the base URL at creation time in the saved object Apr 18, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@Dosant Dosant added Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:FieldFormatters labels Apr 20, 2020
@epol
Copy link

epol commented Apr 23, 2020

There is a similar problem when importing saved objects: all the URLs will use the name of the old instance.
(I'm using kibana 7.6.1)

@lukeelmers lukeelmers added the bug Fixes for quality problems that affect the customer experience label May 14, 2020
@lukeelmers lukeelmers added impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort triaged labels Jul 5, 2020
@lukeelmers
Copy link
Member

Briefly looked at this; instantiating a new field formats service will use the current value from window.location for the parsedUrl fields, but when reading a format from a saved object we will just use whatever values are stored there.

How we want to address this will need further discussion -- I'm actually not clear why we need to store the parsedUrl.origin in the first place when it seems to me the desired behavior would always be to include the current origin, and just have the stored path & template.

duncan-ncc added a commit to ukncsc/lme that referenced this issue Jul 16, 2020
* Updating dashboards and documentation pending Query_url fix elastic/kibana#63924
Fixing formatting
Typo Fix
@zofog
Copy link

zofog commented Nov 13, 2020

Any way to prioritize a fix for this? We have 12 clusters and Kibana objects have to be kept in sync across each of them. This bug is a major pain point right now.

@predogma
Copy link

predogma commented Jan 8, 2021

Note: setting origin value in the fieldFormatMap for the index_pattern to empty string seems to use the current origin. This is useful if the origin could be more then one possible url. For example if going through a LB where there is more then one possible origin.

@zofog
Copy link

zofog commented Jan 29, 2021

This one bit me again today. User exports dashboard from one environment, imports it to all others and breaks all URL formatted fields for everyone. Multiple production support issues ensue. This really is unacceptable and needs higher prioritization. It cannot be the way it was intended to function as it fundamentally breaks Kibana import / export.

@m-adams
Copy link

m-adams commented Feb 18, 2021

I just got to this issue after digging around because a partner building dashboards to distribute hit this issue.
It would be good to see a plan to fix it and maybe any short term work arounds because it will hamper users sharing saved objects.

@mattkime
Copy link
Contributor

I'm making this a priority to fix for 7.13.0 and 7.12.1 releases. I'm not sure if there will be a 7.11.3 but if there is it'll be released there too.

@zofog
Copy link

zofog commented Apr 28, 2021

So this bug fix didn't make it into v7.12.1? That's really disappointing since this feature is just broken.

@Dosant
Copy link
Contributor

Dosant commented May 4, 2021

Did some digging, looks like this we stopped saving parsedUrl since #80548 which landed into 7.11.0. So I think we can consider this bug fixed since 7.11.0.

It looks like we started saving parsedUrl since this pr #53265 which landed into 7.6.0. Apparently, this change was unintentional.

The caveat here, that all URL field-formatters were saved between 7.6.0 up to 7.10.x will include parsedUrl and even 7.11+ Kibana will pick them up. The workaround here is to remove parsedUrl from the field formatters inside the index pattern saved objects. This can be done by the workaround mentioned in the issue description or by just re-saving each field formatted in 7.11+ Kibana.

While debugging this noticed that relative URLs don't resolve well when Kibana has a non-empty based up on when using a non-default space. I checked that the same buggy behavior was in 6.x - long before this particular issue with parsedUrl occurred. I'll file a separate bug issue to cover this: #99171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience discuss Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:FieldFormatters impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort v7.6.0 v7.7.0 v7.8.0 v7.9.0 v7.10.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants