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

Setup Loggers #1183

Closed
wants to merge 23 commits into from
Closed

Conversation

directionless
Copy link
Contributor

@directionless directionless commented May 8, 2023

This PR is an attempt at setting up logging. The goal is to create something like:

flowchart LR
    subgraph inputs
        direction TB
        systemLogger>systemLogger]
        logger>logger]

        %% Force formatting
        systemLogger ~~~ logger
    end

    subgraph destinations
        direction TB
        destSys[(System Log Store)]
        destDebugLog[(debug.json)]
        destMem[(inmemory ring)]
        destStore[(persisted ring)]
    end

    systemLogger --> slTee{tee} --> logger
    slTee --> slFilter[[filter out debug]] --> destSys

    %% force formatting
    logger ~~~ slTee ~~~ systemLogger

    logger --> lTee{tee}
    lTee{tee} --> destDebugLog
    lTee --> destMem
    lTee --> f2[[filter: info higher]] --> destStore

    osquery -. kolide_launcher_logs .-> destMem
    osquery -. kolide_launcher_crit_logs .-> destStore

Loading

To achieve that, this PR adds:

  1. a simple ring buffer, backed by a store
  2. building on that, it creates a ringlogger
  3. a log thicket, which uses these to create that routing.

TODO:

  • replace the logger in main
  • setup osquery table access

Copy link
Contributor

@James-Pickett James-Pickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good, only one tiny nit. Nice work! Very well thought out.

pkg/agent/logrouter/logrouter.go Show resolved Hide resolved
pkg/agent/logrouter/logrouter.go Show resolved Hide resolved
This was referenced Aug 30, 2023
@directionless
Copy link
Contributor Author

Replaced by #1322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants