fleet/server/logging
Victor Lyuboslavsky aaac4b1dfe
Changes needed before gokit/log to slog transition. (#39527)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #38889

PLEASE READ BELOW before looking at file changes

Before converting individual files/packages to slog, we generally need
to make these 2 changes to make the conversion easier:
- Replace uses of `kitlog.With` since they are not fully compatible with
our kitlog adapter
- Directly use the kitlog adapter logger type instead of the kitlog
interface, which will let us have direct access to the underlying slog
logger: `*logging.Logger`

Note: that I did not replace absolutely all uses of `kitlog.Logger`, but
I did remove all uses of `kitlog.With` except for these due to
complexity:
- server/logging/filesystem.go and the other log writers (webhook,
firehose, kinesis, lambda, pubsub, nats)
- server/datastore/mysql/nanomdm_storage.go (adapter pattern)
- server/vulnerabilities/nvd/* (cascades to CLI tools)
- server/service/osquery_utils/queries.go (callback type signatures
cascade broadly)
- cmd/maintained-apps/ (standalone, so can be transitioned later all at
once)

Most of the changes in this PR follow these patterns:
- `kitlog.Logger` type → `*logging.Logger`
- `kitlog.With(logger, ...)` → `logger.With(...)`
- `kitlog.NewNopLogger() → logging.NewNopLogger()`, including similar
variations such as `logging.NewLogfmtLogger(w)` and
`logging.NewJSONLogger(w)`
- removed many now-unused kitlog imports

Unique changes that the PR review should focus on:
- server/platform/logging/kitlog_adapter.go: Core adapter changes
- server/platform/logging/logging.go: New convenience functions
- server/service/integration_logger_test.go: Test changes for slog

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
  - Was added in previous PR

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Refactor**
* Migrated the codebase to a unified internal structured logging system
for more consistent, reliable logs and observability.
* No user-facing functionality changed; runtime behavior and APIs remain
compatible.
* **Tests**
* Updated tests to use the new logging helpers to ensure consistent test
logging and validation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-11 10:08:33 -06:00
..
mock Migrate from aws-sdk-go v1 to v2 (#30308) 2025-06-30 17:45:39 -03:00
filesystem.go Update golangci-lint to v2.4.0 (#33251) 2025-09-22 13:17:11 -05:00
filesystem_test.go Update golangci-lint to v2.4.0 (#33251) 2025-09-22 13:17:11 -05:00
firehose.go Fix STS assume role in aws-sdk-go v2 (#30699) 2025-07-10 13:00:27 -03:00
firehose_test.go Migrate from aws-sdk-go v1 to v2 (#30308) 2025-06-30 17:45:39 -03:00
kafkarest.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
kafkarest_test.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
kinesis.go Fix STS assume role in aws-sdk-go v2 (#30699) 2025-07-10 13:00:27 -03:00
kinesis_test.go Migrate from aws-sdk-go v1 to v2 (#30308) 2025-06-30 17:45:39 -03:00
lambda.go Fix STS assume role in aws-sdk-go v2 (#30699) 2025-07-10 13:00:27 -03:00
lambda_test.go Migrate from aws-sdk-go v1 to v2 (#30308) 2025-06-30 17:45:39 -03:00
logging.go Add support for publishing logs to NATS. (#36527) 2026-01-06 09:10:32 -03:00
nanodep.go Changes needed before gokit/log to slog transition. (#39527) 2026-02-11 10:08:33 -06:00
nats.go Remove valyala/fastjson and valyala/fasttemplate dependencies (#37914) 2026-01-06 16:58:51 -03:00
nats_test.go Add natsWaitOrTimeout helper to fail early if any of the NATS logging tests fail (#39337) 2026-02-06 10:28:40 -03:00
pubsub.go 🧹 friday cleanup party: substitute deprecated import of go-kit (#19774) 2024-06-17 10:27:31 -03:00
stdout.go Add stdout and kinesis logger plugins and sts assume role to Firehose (#2282) 2020-08-19 14:56:44 -07:00
webhook.go Webhook logging destination (#28692) 2025-05-01 16:13:04 -04:00
webhook_test.go Webhook logging destination (#28692) 2025-05-01 16:13:04 -04:00