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

user-defined custom field formats for index patterns can get overwritten by Malcolm #542

Closed
mmguero opened this issue Jan 6, 2025 · 2 comments
Assignees
Labels
bug Something isn't working dashboards Relating to Malcolm's OpenSearch Dashboards interface opensearch Relating to Malcolm's use of OpenSearch
Milestone

Comments

@mmguero
Copy link
Collaborator

mmguero commented Jan 6, 2025

found by @ee-hex-ee

If a user goes into the index pattern and sets custom formatting:

Image

I think what is happening is that if templates have been imported (based on the existing templates' hashes not matching the "standard" template hashes) then the index pattern gets ovewritten, which loses those settings.

I want to create/update the index pattern, but we should see if we can somehow pull out and save existing field format settings beforehand, then reapply them after the creation if they did.

@mmguero mmguero added bug Something isn't working opensearch Relating to Malcolm's use of OpenSearch labels Jan 6, 2025
@mmguero mmguero added this to the v25.01.0 milestone Jan 6, 2025
@mmguero mmguero added this to Malcolm Jan 6, 2025
@mmguero mmguero moved this to Todo (design) in Malcolm Jan 6, 2025
@mmguero mmguero self-assigned this Jan 9, 2025
@mmguero mmguero moved this from Todo (design) to In Progress in Malcolm Jan 13, 2025
@mmguero
Copy link
Collaborator Author

mmguero commented Jan 13, 2025

The field format map can be retrieved like this, externally (same curl command inside the container only without the docker compose stuff):

$ docker compose exec api curl -sSL 'dashboards:5601/dashboards/api/saved_objects/index-pattern/arkime_sessions3-*' | jq '.attributes.fieldFormatMap'
"{\"zeek.dns.query\":{\"id\":\"color\",\"params\":{\"parsedUrl\":{\"origin\":\"https://malcolm.seven.local.lan\",\"pathname\":\"/dashboards/app/dashboards\",\"basePath\":\"/dashboards\"},\"fieldType\":\"string\",\"colors\":[{\"range\":\"-Infinity:Infinity\",\"regex\":\"*chromecast*\",\"text\":\"#ff0000\",\"background\":\"#ffffff\"}]}}}"

@mmguero
Copy link
Collaborator Author

mmguero commented Jan 13, 2025

and stripping some of the parsedUrl stuff we wouldn't want to save:

$ docker compose exec api curl -sSL 'dashboards:5601/dashboards/api/saved_objects/index-pattern/arkime_sessions3-*' | jq -r '.attributes.fieldFormatMap' | jq -c 'with_entries(.value.params.parsedUrl? = null | del(.value.params.parsedUrl))'  | jq '@json'

results in:

"{\"zeek.dns.query\":{\"id\":\"color\",\"params\":{\"fieldType\":\"string\",\"colors\":[{\"range\":\"-Infinity:Infinity\",\"regex\":\"*chromecast*\",\"text\":\"#ff0000\",\"background\":\"#ffffff\"}]}},\"related.role\":{\"id\":\"color\",\"params\":{\"fieldType\":\"string\",\"colors\":[{\"range\":\"-Infinity:Infinity\",\"regex\":\"*HMI*\",\"text\":\"#54B399\",\"background\":\"#ffffff\"}]}}}"

mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 13, 2025
@mmguero mmguero moved this from In Progress to Testing in Malcolm Jan 13, 2025
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jan 13, 2025
@mmguero mmguero added the dashboards Relating to Malcolm's OpenSearch Dashboards interface label Jan 14, 2025
@mmguero mmguero closed this as completed Jan 14, 2025
@github-project-automation github-project-automation bot moved this from Testing to Done in Malcolm Jan 14, 2025
This was referenced Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dashboards Relating to Malcolm's OpenSearch Dashboards interface opensearch Relating to Malcolm's use of OpenSearch
Projects
Status: Done
Development

No branches or pull requests

1 participant