v0.5.1 minor basic auth bug fixes, dependency udpate, test scripts are being added
This commit is contained in:
@@ -50,16 +50,10 @@ func initializeLogger(cfg *config.Config) error {
|
||||
logger = log.NewLogger()
|
||||
logCfg := log.DefaultConfig()
|
||||
|
||||
// Prevent empty directory creation if file logging is not configured
|
||||
if cfg.Logging.Output != "file" && cfg.Logging.Output != "all" {
|
||||
logCfg.DisableFile = true
|
||||
logCfg.Directory = ""
|
||||
}
|
||||
|
||||
if cfg.Quiet {
|
||||
// In quiet mode, disable ALL logging output
|
||||
logCfg.Level = 255 // A level that disables all output
|
||||
logCfg.DisableFile = true
|
||||
logCfg.EnableFile = false
|
||||
logCfg.EnableConsole = false
|
||||
return logger.ApplyConfig(logCfg)
|
||||
}
|
||||
@@ -74,22 +68,26 @@ func initializeLogger(cfg *config.Config) error {
|
||||
// Configure based on output mode
|
||||
switch cfg.Logging.Output {
|
||||
case "none":
|
||||
logCfg.EnableFile = false
|
||||
logCfg.EnableConsole = false
|
||||
case "stdout":
|
||||
logCfg.EnableFile = false
|
||||
logCfg.EnableConsole = true
|
||||
logCfg.ConsoleTarget = "stdout"
|
||||
case "stderr":
|
||||
logCfg.EnableFile = false
|
||||
logCfg.EnableConsole = true
|
||||
logCfg.ConsoleTarget = "stderr"
|
||||
case "split":
|
||||
logCfg.EnableFile = false
|
||||
logCfg.EnableConsole = true
|
||||
logCfg.ConsoleTarget = "split"
|
||||
case "file":
|
||||
logCfg.DisableFile = false
|
||||
logCfg.EnableFile = true
|
||||
logCfg.EnableConsole = false
|
||||
configureFileLogging(logCfg, cfg)
|
||||
case "all":
|
||||
logCfg.DisableFile = false
|
||||
logCfg.EnableFile = true
|
||||
logCfg.EnableConsole = true
|
||||
logCfg.ConsoleTarget = "split"
|
||||
configureFileLogging(logCfg, cfg)
|
||||
|
||||
@@ -121,6 +121,11 @@ func (s *Service) NewPipeline(cfg config.PipelineConfig) error {
|
||||
pipeline.Sinks = append(pipeline.Sinks, sinkInst)
|
||||
}
|
||||
|
||||
// Configure authentication for sources that support it before starting them
|
||||
for _, sourceInst := range pipeline.Sources {
|
||||
sourceInst.SetAuth(cfg.Auth)
|
||||
}
|
||||
|
||||
// Start all sources
|
||||
for i, src := range pipeline.Sources {
|
||||
if err := src.Start(); err != nil {
|
||||
@@ -129,9 +134,9 @@ func (s *Service) NewPipeline(cfg config.PipelineConfig) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Configure authentication for sources that support it
|
||||
for _, sourceInst := range pipeline.Sources {
|
||||
sourceInst.SetAuth(cfg.Auth)
|
||||
// Configure authentication for sinks that support it before starting them
|
||||
for _, sinkInst := range pipeline.Sinks {
|
||||
sinkInst.SetAuth(cfg.Auth)
|
||||
}
|
||||
|
||||
// Start all sinks
|
||||
@@ -142,11 +147,6 @@ func (s *Service) NewPipeline(cfg config.PipelineConfig) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Configure authentication for sinks that support it
|
||||
for _, sinkInst := range pipeline.Sinks {
|
||||
sinkInst.SetAuth(cfg.Auth)
|
||||
}
|
||||
|
||||
// Wire sources to sinks through filters
|
||||
s.wirePipeline(pipeline)
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ func (h *HTTPSink) Start(ctx context.Context) error {
|
||||
fasthttpLogger := compat.NewFastHTTPAdapter(h.logger)
|
||||
|
||||
h.server = &fasthttp.Server{
|
||||
Name: fmt.Sprintf("LogWisp/%s", version.Short()),
|
||||
Handler: h.requestHandler,
|
||||
DisableKeepalive: false,
|
||||
StreamRequestBody: true,
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"logwisp/src/internal/auth"
|
||||
"logwisp/src/internal/config"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -17,8 +15,11 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"logwisp/src/internal/auth"
|
||||
"logwisp/src/internal/config"
|
||||
"logwisp/src/internal/core"
|
||||
"logwisp/src/internal/format"
|
||||
"logwisp/src/internal/version"
|
||||
|
||||
"github.com/lixenwraith/log"
|
||||
"github.com/valyala/fasthttp"
|
||||
@@ -441,6 +442,8 @@ func (h *HTTPClientSink) sendBatch(batch []core.LogEntry) {
|
||||
req.Header.SetContentType("application/json")
|
||||
req.SetBody(body)
|
||||
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("LogWisp/%s", version.Short()))
|
||||
|
||||
// Add Basic Auth header if credentials configured
|
||||
if h.config.Username != "" && h.config.Password != "" {
|
||||
creds := h.config.Username + ":" + h.config.Password
|
||||
|
||||
@@ -4,16 +4,17 @@ package source
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"logwisp/src/internal/auth"
|
||||
"net"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"logwisp/src/internal/auth"
|
||||
"logwisp/src/internal/config"
|
||||
"logwisp/src/internal/core"
|
||||
"logwisp/src/internal/limit"
|
||||
"logwisp/src/internal/tls"
|
||||
"logwisp/src/internal/version"
|
||||
|
||||
"github.com/lixenwraith/log"
|
||||
"github.com/valyala/fasthttp"
|
||||
@@ -180,6 +181,7 @@ func (h *HTTPSource) Subscribe() <-chan core.LogEntry {
|
||||
|
||||
func (h *HTTPSource) Start() error {
|
||||
h.server = &fasthttp.Server{
|
||||
Name: fmt.Sprintf("LogWisp/%s", version.Short()),
|
||||
Handler: h.requestHandler,
|
||||
DisableKeepalive: false,
|
||||
StreamRequestBody: true,
|
||||
|
||||
Reference in New Issue
Block a user