reorganize log pkg
This commit is contained in:
parent
a93a696bd0
commit
687c344c7b
|
@ -15,18 +15,18 @@ import (
|
|||
coreconfig "flashcat.cloud/categraf/config"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/auditor"
|
||||
"flashcat.cloud/categraf/pkg/logs/client"
|
||||
"flashcat.cloud/categraf/pkg/logs/client/http"
|
||||
"flashcat.cloud/categraf/pkg/logs/diagnostic"
|
||||
"flashcat.cloud/categraf/pkg/logs/input/file"
|
||||
"flashcat.cloud/categraf/pkg/logs/input/journald"
|
||||
"flashcat.cloud/categraf/pkg/logs/input/listener"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/pkg/logs/restart"
|
||||
"flashcat.cloud/categraf/pkg/logs/service"
|
||||
logService "flashcat.cloud/categraf/pkg/logs/service"
|
||||
"flashcat.cloud/categraf/pkg/logs/status"
|
||||
"flashcat.cloud/categraf/logs/auditor"
|
||||
"flashcat.cloud/categraf/logs/client"
|
||||
"flashcat.cloud/categraf/logs/client/http"
|
||||
"flashcat.cloud/categraf/logs/diagnostic"
|
||||
"flashcat.cloud/categraf/logs/input/file"
|
||||
"flashcat.cloud/categraf/logs/input/journald"
|
||||
"flashcat.cloud/categraf/logs/input/listener"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/restart"
|
||||
"flashcat.cloud/categraf/logs/service"
|
||||
logService "flashcat.cloud/categraf/logs/service"
|
||||
"flashcat.cloud/categraf/logs/status"
|
||||
)
|
||||
|
||||
// LogAgent represents the data pipeline that collects, decodes,
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"time"
|
||||
|
||||
config "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// DefaultRegistryFilename is the default registry filename
|
|
@ -1,7 +1,7 @@
|
|||
package auditor
|
||||
|
||||
import (
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// NullAuditor is an auditor not doing anything with the message it received.
|
|
@ -13,7 +13,7 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/client"
|
||||
"flashcat.cloud/categraf/logs/client"
|
||||
"flashcat.cloud/categraf/pkg/util/backoff"
|
||||
httputils "flashcat.cloud/categraf/pkg/util/http"
|
||||
)
|
|
@ -21,7 +21,7 @@ import (
|
|||
"golang.org/x/net/proxy"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/status"
|
||||
"flashcat.cloud/categraf/logs/status"
|
||||
)
|
||||
|
||||
const (
|
|
@ -11,7 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/client"
|
||||
"flashcat.cloud/categraf/logs/client"
|
||||
)
|
||||
|
||||
const (
|
|
@ -13,7 +13,7 @@ import (
|
|||
"time"
|
||||
|
||||
config "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/parser"
|
||||
"flashcat.cloud/categraf/logs/parser"
|
||||
)
|
||||
|
||||
// defaultContentLenLimit represents the max size for a line,
|
|
@ -10,7 +10,7 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/parser"
|
||||
"flashcat.cloud/categraf/logs/parser"
|
||||
)
|
||||
|
||||
// LineParser e
|
|
@ -12,7 +12,7 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// MessageReceiver interface to handle messages for diagnostics
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
package diagnostic
|
||||
|
||||
import "flashcat.cloud/categraf/pkg/logs/message"
|
||||
import "flashcat.cloud/categraf/logs/message"
|
||||
|
||||
// NoopMessageReceiver for cases where diagnosing messages is unsupported or not needed (serverless, tests)
|
||||
type NoopMessageReceiver struct{}
|
|
@ -7,7 +7,7 @@ package channel
|
|||
|
||||
import (
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
)
|
||||
|
||||
// Launcher starts a channel reader on the given channel of string.
|
|
@ -11,7 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// serviceEnvVar is the environment variable of the service tag (this is used only for the serverless agent)
|
|
@ -13,7 +13,7 @@ import (
|
|||
"sort"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/status"
|
||||
"flashcat.cloud/categraf/logs/status"
|
||||
)
|
||||
|
||||
// OpenFilesLimitWarningType is the key of the message generated when too many
|
|
@ -10,7 +10,7 @@ import (
|
|||
"strconv"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/auditor"
|
||||
"flashcat.cloud/categraf/logs/auditor"
|
||||
)
|
||||
|
||||
// Position returns the position from where logs should be collected.
|
|
@ -15,10 +15,10 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/auditor"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/pkg/logs/restart"
|
||||
"flashcat.cloud/categraf/logs/auditor"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/restart"
|
||||
)
|
||||
|
||||
// rxContainerID is used in the shouldIgnore func to do a best-effort validation
|
|
@ -18,10 +18,10 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/decoder"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/pkg/logs/parser"
|
||||
"flashcat.cloud/categraf/pkg/logs/tag"
|
||||
"flashcat.cloud/categraf/logs/decoder"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
"flashcat.cloud/categraf/logs/parser"
|
||||
"flashcat.cloud/categraf/logs/tag"
|
||||
)
|
||||
|
||||
// DefaultSleepDuration represents the amount of time the tailer waits before reading new data when no data is received
|
|
@ -14,7 +14,7 @@ import (
|
|||
"log"
|
||||
"path/filepath"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/decoder"
|
||||
"flashcat.cloud/categraf/logs/decoder"
|
||||
)
|
||||
|
||||
// setup sets up the file tailer
|
|
@ -14,7 +14,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/decoder"
|
||||
"flashcat.cloud/categraf/logs/decoder"
|
||||
)
|
||||
|
||||
// setup sets up the file tailer
|
|
@ -11,9 +11,9 @@ package journald
|
|||
import (
|
||||
"log"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/auditor"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/pkg/logs/restart"
|
||||
"flashcat.cloud/categraf/logs/auditor"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/restart"
|
||||
)
|
||||
|
||||
// Launcher is in charge of starting and stopping new journald tailers
|
|
@ -10,8 +10,8 @@ package journald
|
|||
|
||||
import (
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/auditor"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/auditor"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
)
|
||||
|
||||
// Launcher is not supported on no systemd environment.
|
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/coreos/go-systemd/sdjournal"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// defaultWaitDuration represents the delay before which we try to collect a new log from the journal
|
|
@ -7,8 +7,8 @@ package listener
|
|||
|
||||
import (
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/pkg/logs/restart"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/restart"
|
||||
)
|
||||
|
||||
// Launcher summons different protocol specific listeners based on configuration
|
|
@ -11,9 +11,9 @@ import (
|
|||
"net"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/decoder"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/pkg/logs/parser"
|
||||
"flashcat.cloud/categraf/logs/decoder"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
"flashcat.cloud/categraf/logs/parser"
|
||||
)
|
||||
|
||||
// Tailer reads data from a connection
|
|
@ -13,8 +13,8 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/pkg/logs/restart"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/restart"
|
||||
)
|
||||
|
||||
// A TCPListener listens and accepts TCP connections and delegates the read operations to a tailer.
|
|
@ -11,7 +11,7 @@ import (
|
|||
"net"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/pipeline"
|
||||
"flashcat.cloud/categraf/logs/pipeline"
|
||||
)
|
||||
|
||||
// The UDP listener is limited by the size of its read buffer,
|
|
@ -9,13 +9,13 @@ import (
|
|||
"context"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/client"
|
||||
"flashcat.cloud/categraf/pkg/logs/client/http"
|
||||
"flashcat.cloud/categraf/pkg/logs/client/tcp"
|
||||
"flashcat.cloud/categraf/pkg/logs/diagnostic"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/pkg/logs/processor"
|
||||
"flashcat.cloud/categraf/pkg/logs/sender"
|
||||
"flashcat.cloud/categraf/logs/client"
|
||||
"flashcat.cloud/categraf/logs/client/http"
|
||||
"flashcat.cloud/categraf/logs/client/tcp"
|
||||
"flashcat.cloud/categraf/logs/diagnostic"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
"flashcat.cloud/categraf/logs/processor"
|
||||
"flashcat.cloud/categraf/logs/sender"
|
||||
)
|
||||
|
||||
// Pipeline processes and sends messages to the backend
|
|
@ -9,13 +9,13 @@ import (
|
|||
"context"
|
||||
"sync/atomic"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/diagnostic"
|
||||
"flashcat.cloud/categraf/logs/diagnostic"
|
||||
|
||||
config "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/auditor"
|
||||
"flashcat.cloud/categraf/pkg/logs/client"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/pkg/logs/restart"
|
||||
"flashcat.cloud/categraf/logs/auditor"
|
||||
"flashcat.cloud/categraf/logs/client"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
"flashcat.cloud/categraf/logs/restart"
|
||||
)
|
||||
|
||||
// Provider provides message channels
|
|
@ -9,7 +9,7 @@ import (
|
|||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// Encoder turns a message into a raw byte array ready to be sent.
|
|
@ -9,7 +9,7 @@ import (
|
|||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
const nanoToMillis = 1000000
|
|
@ -9,7 +9,7 @@ import (
|
|||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// JSONServerlessEncoder is a shared json encoder sending a struct message field
|
|
@ -11,8 +11,8 @@ import (
|
|||
"sync"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/diagnostic"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/diagnostic"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// A Processor updates messages from an inputChan and pushes
|
|
@ -8,8 +8,8 @@ package processor
|
|||
import (
|
||||
"time"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/pkg/logs/pb"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
"flashcat.cloud/categraf/logs/pb"
|
||||
)
|
||||
|
||||
// ProtoEncoder is a shared proto encoder.
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
logsconfig "flashcat.cloud/categraf/config/logs"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// RawEncoder is a shared raw encoder.
|
|
@ -11,7 +11,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// batchStrategy contains all the logic to send logs in batch.
|
|
@ -6,7 +6,7 @@
|
|||
package sender
|
||||
|
||||
import (
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// MessageBuffer accumulates messages to a buffer until the max capacity is reached.
|
|
@ -8,8 +8,8 @@ package sender
|
|||
import (
|
||||
"context"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/client"
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/client"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// Strategy should contain all logic to send logs to a remote destination
|
|
@ -8,7 +8,7 @@ package sender
|
|||
import (
|
||||
"bytes"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
var (
|
|
@ -9,7 +9,7 @@ import (
|
|||
"context"
|
||||
"log"
|
||||
|
||||
"flashcat.cloud/categraf/pkg/logs/message"
|
||||
"flashcat.cloud/categraf/logs/message"
|
||||
)
|
||||
|
||||
// StreamStrategy is a shared stream strategy.
|
Loading…
Reference in New Issue