Applying settings /app/logs/settings via an API

I am able to manually configure the setting for logs streams from

https:/kibanahost:5601/app/logs/settings

I want to do this programmatically but cannot seem to find the API to do this.
Can anyone help point me in the right direction?

Hi @angelom888,

Welcome to the Elastic community :partying_face:

Usually, Kibana shows the equivalent HTTP request that the UI is handling — when the user is supposed to perform that request directly. Sometimes this is impossible because the internal index that holds the information is hidden and not supposed to be touched. I'm afraid this is the case for the logging settings.

You could hack your way out by enabling the browser's debugging console and discovering which requests are executing — but that might be an unsupported operation.

@riferrei

Looks like I may have found the solution myself.

I tried to get the data myself

https://angelo-otm.eng.stormagic.com:5601/s/default/api/saved_objects/infrastructure-ui-source/default

and it returned

{"id":"default","type":"infrastructure-ui-source","namespaces":["default"],"updated_at":"2021-11-04T10:53:48.520Z","version":"WzU2MjksNF0=","attributes":{"name":"Default","description":"","metricAlias":"metrics-,metricbeat-","logIndices":{"type":"index_pattern","indexPatternId":"log_index_pattern_0"},"fields":{"container":"container.id","host":"host.name","message":["message","@message"],"pod":"kubernetes.pod.uid","tiebreaker":"_doc","timestamp":"@timestamp"},"inventoryDefaultView":"0","metricsExplorerDefaultView":"0","logColumns":[{"timestampColumn":{"id":"5e7f964a-be8a-40d8-88d2-fbcfbdca0e2f"}},{"fieldColumn":{"id":"c72eaf17-12ec-47de-b240-b11da83be718","field":"host.hostname"}},{"fieldColumn":{"id":"96219ad4-a012-42fc-9a67-d4d08f2f3d8b","field":"fields.hosttype"}},{"fieldColumn":{"id":"32c221d0-02b3-4b1d-9aa3-4cc01cb51bd6","field":"fields.logtype"}},{"fieldColumn":{"id":"c4d9e647-58a3-4470-8c23-a89a2a78a4a6","field":"syslog_severity"}},{"fieldColumn":{"id":"2d7bc33c-ba0b-4d7c-a5c7-bbfc470e90e5","field":"syslog_program"}},{"messageColumn":{"id":"b645d6da-824b-4723-9a2a-e8cece1645c0"}}],"anomalyThreshold":50},"references":[{"id":"561afbc0-2a97-11ec-a753-39d939b89a0c","type":"index-pattern","name":"log_index_pattern_0"}],"migrationVersion":{"infrastructure-ui-source":"7.13.0"},"coreMigrationVersion":"7.13.4"}

I haven't tried posting it yet,
but maybe I have the solution.

Hi @angelom888,

you're on the right track there. The configuration for the Logs and Metrics UIs are just saved objects of type "infrastructure-ui-source", which you can import and export using the official API or the UI.

It's the safest way because it takes care of the migrations and index pattern references too.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.