elastic / connectors

Source code for all Elastic connectors, developed by the Search team at Elastic, and home of our Python connector development framework
https://www.elastic.co/guide/en/enterprise-search/master/index.html
Other
71 stars 126 forks source link

Update approach to logging in connector component #2809

Closed artem-shelkovnikov closed 4 days ago

artem-shelkovnikov commented 3 weeks ago

Closes https://github.com/elastic/connectors/issues/2792

Multiple logging-related changes and a small bugfix bundled together:

  1. Now Agent Python component and Connectors hosted by it will log in ECS format. This will make agent/fleet parse logs better and provide better UX (see screenshots later)
  2. Logging is actually consistently implemented in the agent component. There's a root logger and each file creates a child logger. Changes for root logger are automatically bubbled to child loggers which is nice
  3. Added logging into all agent python component files
  4. Python Agent Component now reacts to changes in log_level and properly bubbles log level changes to connectors as well
  5. Fixed a bug when you change only log_level for fleet policy for the connector and it corrupts the configuration

Screenshots of the change in the Fleet UI:

image image

Checklists

Pre-Review Checklist

jedrazb commented 1 week ago

For some reason python elastic agent logs have error level

Screenshot 2024-09-20 at 13 59 07
artem-shelkovnikov commented 1 week ago

@jedrazb this gets fixed with this change: https://github.com/elastic/python-elastic-agent-client/pull/62

You can update requirements.txt to point to my branch artem/update-component-logger for the python elastic agent and see it yourself :)

github-actions[bot] commented 4 days ago

💚 Backport PR(s) successfully created

Status Branch Result
8.x https://github.com/elastic/connectors/pull/2847

This backport PR will be merged automatically after passing CI.