elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
124 stars 134 forks source link

Watcher logs messages are incorrectly formatted #4444

Open blakerouse opened 6 months ago

blakerouse commented 6 months ago

The following log messages are incorrectly formatted:

{"log.level":"info","@timestamp":"2024-03-19T23:57:51.201Z","log.origin":{"file.name":"upgrade/upgrade.go","file.line":348},"message":"waiting up to %s for upgrade watcher to set %s state in upgrade marker30sUPG_WATCHING","log":{"source":"elastic-agent"},"ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2024-03-19T23:57:51.436Z","log.origin":{"file.name":"upgrade/upgrade.go","file.line":355},"message":"upgrade watcher set %s state in upgrade marker: exiting wait loopUPG_WATCHING","log":{"source":"elastic-agent"},"ecs.version":"1.6.0"}

For confirmed bugs, please report:

elasticmachine commented 6 months ago

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

blakerouse commented 6 months ago

Another log message that looks broken:

{"log.level":"error","@timestamp":"2024-03-20T00:00:21.471Z","log.origin":{"file.name":"cmd/watch.go","file.line":117},"message":"Error detected, proceeding to rollback: %vfailed to connect to agent daemon '5' times in a row","ecs.version":"1.6.0"}
blakerouse commented 6 months ago

Another:

{"log.level":"error","@timestamp":"2024-03-20T00:04:36.551Z","log.origin":{"file.name":"cmd/watch.go","file.line":122},"message":"rollback failedfailed to restart agent via service: failed to restart service (Elastic Agent): The service has not been started.","ecs.version":"1.6.0"}
amitkanfer commented 6 months ago

is there a linting rule we can turn on to prevent these from happening again? I can imagine there's a simple regex to detect these issues