Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
095daf1
Update log writing with correct use of 'catcher' in the sophos integr…
JocLRojas Sep 19, 2025
e58d0b0
Update log writing with correct use of 'catcher' in the soc-ai integr…
JocLRojas Sep 19, 2025
bca35a7
Update log writing with correct use of 'catcher' in the office365 int…
JocLRojas Sep 19, 2025
9c8026e
Update log writing with correct use of 'catcher' in the office365 and…
JocLRojas Sep 19, 2025
bfbdc08
Update log writing with correct use of 'catcher' in the aws integration.
JocLRojas Sep 19, 2025
55208fa
Update log writing with correct use of 'catcher' in the bitdefender i…
JocLRojas Sep 19, 2025
af8ca7f
Update log writing with correct use of 'catcher' in the agent-manager…
JocLRojas Sep 19, 2025
582609f
Update log writing with correct use of 'catcher' in the log-auth-proxy.
JocLRojas Sep 19, 2025
14217a4
Update log writing with correct use of 'catcher' in the correlation e…
JocLRojas Sep 22, 2025
681d88b
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
555c538
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
5430b32
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
9af3754
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
fc19301
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
a0ca4c5
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
cc4d578
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
63a84ef
Use 'nil' instead of empty map in 'catcher' calls system. Improve cod…
JocLRojas Sep 22, 2025
e610219
feat: implement auditing and logging enhancements with new exception …
mjabascal10 Oct 14, 2025
10c7265
feat: enhance login functionality with auditing support and improved …
mjabascal10 Oct 14, 2025
e76b8cc
chore: restore Dockerfile
mjabascal10 Oct 14, 2025
5fb970d
feat: add DTOs for module activation and configuration, enhance modul…
mjabascal10 Oct 14, 2025
d056602
feat: enhance UtmIncident resource with auditing support and improved…
mjabascal10 Oct 14, 2025
87abf6b
feat: add request body DTOs for alert management with auditing support
mjabascal10 Oct 14, 2025
7d69c79
refactor(audit-log): update UtmFilterQueryService to use UtmFilter in…
mjabascal10 Oct 14, 2025
6f6f844
Merge branch 'v10' into release/v10.9.3
JocLRojas Nov 12, 2025
afe36e4
feat(agent/syslog): add RFC 5424 octet counting framing support and i…
JocLRojas Nov 12, 2025
5586375
Merge branch 'v10' into release/v10.9.3
JocLRojas Nov 13, 2025
627ea1c
Disable Threat Intelligence feeds and processing
JocLRojas Nov 17, 2025
000ba0e
Merge branch 'v10' into release/v10.9.3
mjabascal10 Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent-manager/agent/agent_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package agent
import (
"context"

"github.com/threatwinds/go-sdk/catcher"
"github.com/utmstack/UTMStack/agent-manager/util"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand All @@ -15,7 +16,7 @@ func (s *Grpc) ListAgentCommands(ctx context.Context, req *ListRequest) (*ListAg

commands, total, err := agentCommandService.ListAgentCommands(page, filter)
if err != nil {
util.Logger.ErrorF("failed to fetch agents: %v", err)
catcher.Error("failed to fetch agents", err, nil)
return nil, status.Errorf(codes.Internal, "failed to fetch agents: %v", err)
}

Expand Down
49 changes: 25 additions & 24 deletions agent-manager/agent/agent_imp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/google/uuid"
"github.com/threatwinds/go-sdk/catcher"
"github.com/utmstack/UTMStack/agent-manager/models"
"github.com/utmstack/UTMStack/agent-manager/util"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -39,7 +40,7 @@ func (s *Grpc) RegisterAgent(ctx context.Context, req *AgentRequest) (*AuthRespo
Key: oldAgent.AgentKey,
}, nil
} else {
util.Logger.ErrorF("Agent with hostname %s already exists", agent.Hostname)
catcher.Error("Agent already exists", nil, map[string]any{"host_name": agent.Hostname})
return nil, status.Errorf(codes.AlreadyExists, "hostname has already been registered")
}
}
Expand All @@ -48,7 +49,7 @@ func (s *Grpc) RegisterAgent(ctx context.Context, req *AgentRequest) (*AuthRespo
agent.AgentKey = key
err = agentService.Create(agent)
if err != nil {
util.Logger.ErrorF("Failed to create agent: %v", err)
catcher.Error("Failed to create agent", err, nil)
return nil, err
}

Expand All @@ -58,15 +59,15 @@ func (s *Grpc) RegisterAgent(ctx context.Context, req *AgentRequest) (*AuthRespo

err = lastSeenService.Set(key, time.Now())
if err != nil {
util.Logger.ErrorF("Failed to set last seen: %v", err)
catcher.Error("Failed to set last seen", err, nil)
return nil, err
}
res := &AuthResponse{
Id: uint32(agent.ID),
Key: key,
}

util.Logger.Info("Agent %s with id %d registered correctly", agent.Hostname, agent.ID)
catcher.Info("Agent was registered correctly", map[string]any{"hostname": agent.Hostname, "id": agent.ID})
return res, nil
}

Expand All @@ -88,7 +89,7 @@ func (s *Grpc) UpdateAgent(ctx context.Context, req *AgentRequest) (*AuthRespons

agent, err := agentService.FindByID(uint(id))
if err != nil {
util.Logger.ErrorF("Failed to find agent: %v", err)
catcher.Error("Failed to find agent", err, nil)
return nil, err
}

Expand Down Expand Up @@ -119,7 +120,7 @@ func (s *Grpc) UpdateAgent(ctx context.Context, req *AgentRequest) (*AuthRespons

err = agentService.Update(agent)
if err != nil {
util.Logger.ErrorF("Failed to update agent: %v", err)
catcher.Error("Failed to update agent", err, nil)
return nil, err
}

Expand All @@ -128,7 +129,7 @@ func (s *Grpc) UpdateAgent(ctx context.Context, req *AgentRequest) (*AuthRespons
Key: agent.AgentKey,
}

util.Logger.Info("Agent %s with id %d updated correctly", agent.Hostname, agent.ID)
catcher.Info("Agent was updated correctly", map[string]any{"hostname": agent.Hostname, "id": agent.ID})
return res, nil
}

Expand All @@ -146,7 +147,7 @@ func (s *Grpc) DeleteAgent(ctx context.Context, req *AgentDelete) (*AuthResponse

id, err := agentService.Delete(uuid.MustParse(key), req.DeletedBy)
if err != nil {
util.Logger.ErrorF("Unable to delete agent: %v", err)
catcher.Error("Unable to delete agent", err, nil)
return &AuthResponse{}, status.Error(codes.Internal, fmt.Sprintf("unable to delete agent: %v", err.Error()))
}

Expand All @@ -158,7 +159,7 @@ func (s *Grpc) DeleteAgent(ctx context.Context, req *AgentDelete) (*AuthResponse
delete(s.AgentStreamMap, key)
s.agentStreamMutex.Unlock()

util.Logger.Info("Agent with key %s deleted by %s", key, req.DeletedBy)
catcher.Info("Agent was deleted", map[string]any{"key": key, "deleted_by": req.DeletedBy})

return &AuthResponse{
Id: uint32(id),
Expand All @@ -173,7 +174,7 @@ func (s *Grpc) ListAgents(ctx context.Context, req *ListRequest) (*ListAgentsRes

agents, total, err := agentService.ListAgents(page, filter)
if err != nil {
util.Logger.ErrorF("failed to fetch agents: %v", err)
catcher.Error("failed to fetch agents", err, nil)
return nil, status.Errorf(codes.Internal, "failed to fetch agents: %v", err)
}
return convertToAgentResponse(agents, total)
Expand Down Expand Up @@ -202,7 +203,7 @@ func (s *Grpc) AgentStream(stream AgentService_AgentStreamServer) error {
delete(s.AgentStreamMap, agentKey)
s.agentStreamMutex.Unlock()

util.Logger.ErrorF("failed to reconnect to client: %v", err)
catcher.Error("failed to reconnect to client", err, nil)
return fmt.Errorf("failed to reconnect to client: %v", err)
}

Expand All @@ -226,10 +227,10 @@ func (s *Grpc) AgentStream(stream AgentService_AgentStreamServer) error {

switch msg := in.StreamMessage.(type) {
case *BidirectionalStream_Command:
util.Logger.Info("Received command: %s", msg.Command.CmdId)
catcher.Info("Received command", map[string]any{"cmd_id": msg.Command.CmdId})

case *BidirectionalStream_Result:
util.Logger.Info("Received command result: %s", msg.Result.CmdId)
catcher.Info("Received command result", map[string]any{"cmd_id": msg.Result.CmdId})

cmdID := msg.Result.GetCmdId()

Expand All @@ -244,7 +245,7 @@ func (s *Grpc) AgentStream(stream AgentService_AgentStreamServer) error {
},
},
}); err != nil {
util.Logger.ErrorF("Failed to send result to server: %v", err)
catcher.Error("Failed to send result to server", err, nil)
}
s.resultChannelM.Lock()
if resultChan, ok := s.ResultChannel[cmdID]; ok {
Expand All @@ -256,7 +257,7 @@ func (s *Grpc) AgentStream(stream AgentService_AgentStreamServer) error {
}

} else {
util.Logger.ErrorF("Failed to find result channel for CmdID: %s", cmdID)
catcher.Error("Failed to find result channel for CmdID", nil, map[string]any{"cmd_id": cmdID})
}
s.resultChannelM.Unlock()
}
Expand Down Expand Up @@ -346,25 +347,25 @@ func (s *Grpc) ProcessCommand(stream PanelService_ProcessCommandServer) error {

func (s *Grpc) UpdateAgentGroup(ctx context.Context, req *AgentGroupUpdate) (*Agent, error) {
if req.AgentId == 0 || req.AgentGroup == 0 {
util.Logger.ErrorF("Error in req")
catcher.Error("Error in req", nil, nil)
return nil, status.Errorf(codes.FailedPrecondition, "error in req")
}
agent, err := agentService.UpdateAgentGroup(uint(req.AgentId), uint(req.AgentGroup))
if err != nil {
util.Logger.ErrorF("Unable to update group: %v", err)
catcher.Error("Unable to update group", err, nil)
return nil, status.Errorf(codes.Internal, "unable to update group: %v", err)
}
return parseAgentToProto(agent), nil
}

func (s *Grpc) GetAgentByHostname(ctx context.Context, req *Hostname) (*Agent, error) {
if req.Hostname == "" {
util.Logger.ErrorF("Error in req")
catcher.Error("Error in req", nil, nil)
return nil, status.Errorf(codes.FailedPrecondition, "error in req")
}
agent, err := agentService.FindByHostname(req.Hostname)
if err != nil {
util.Logger.ErrorF("Unable to find agent with hostname: %v", err)
catcher.Error("Unable to find agent with hostname", err, nil)
return nil, status.Errorf(codes.NotFound, "unable to find agent with hostname: %v", err)
}
return parseAgentToProto(*agent), nil
Expand All @@ -376,7 +377,7 @@ func (s *Grpc) UpdateAgentType(ctx context.Context, req *AgentTypeUpdate) (*Agen
}
agent, err := agentService.UpdateAgentType(uint(req.AgentId), uint(req.AgentType))
if err != nil {
util.Logger.ErrorF("Unable to update type: %v", err)
catcher.Error("Unable to update type", err, nil)
return nil, status.Errorf(codes.Internal, "unable to update type: %v", err)
}
return parseAgentToProto(agent), nil
Expand All @@ -387,7 +388,7 @@ func (s *Grpc) LoadAgentCacheFromDatabase() error {
// Fill the agentCache map with agentID and agentToken pairs
agents, err := agentService.FindAll()
if err != nil {
util.Logger.ErrorF("Failed to fetch agents from database: %v", err)
catcher.Error("Failed to fetch agents from database", err, nil)
return err
}
for _, agent := range agents {
Expand All @@ -403,7 +404,7 @@ func (s *Grpc) ListAgentsWithCommands(ctx context.Context, req *ListRequest) (*L

agents, total, err := agentService.ListAgentWithCommands(page, filter)
if err != nil {
util.Logger.ErrorF("failed to fetch agents: %v", err)
catcher.Error("failed to fetch agents", err, nil)
return nil, status.Errorf(codes.Internal, "failed to fetch agents: %v", err)
}

Expand Down Expand Up @@ -459,14 +460,14 @@ func createHistoryCommand(cmd *UtmCommand, cmdID string) {
}
err := agentCommandService.Create(cmdHistory)
if err != nil {
util.Logger.ErrorF("Unable to create a new command history")
catcher.Error("Unable to create a new command history", err, nil)
}
}

func updateHistoryCommand(cmdResult *CommandResult, cmdID string) {
err := agentCommandService.UpdateCommandStatusAndResult(findAgentIdByKey(CacheAgent, cmdResult.AgentKey), cmdID, models.Executed, cmdResult.Result)
if err != nil {
util.Logger.ErrorF("Failed to update command status")
catcher.Error("Failed to update command status", nil, nil)
}
}

Expand Down
33 changes: 17 additions & 16 deletions agent-manager/agent/collector_imp.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/google/uuid"
"github.com/threatwinds/go-sdk/catcher"
"github.com/utmstack/UTMStack/agent-manager/models"
"github.com/utmstack/UTMStack/agent-manager/util"
"google.golang.org/grpc/codes"
Expand All @@ -30,7 +31,7 @@ func (s *Grpc) RegisterCollector(ctx context.Context, req *RegisterRequest) (*Au
Key: oldCollector[0].CollectorKey,
}, nil
} else {
util.Logger.ErrorF("Collector %s(%s) with id %d already registered with different IP", oldCollector[0].Hostname, oldCollector[0].Module, oldCollector[0].ID)
catcher.Error("Collector is already registered with different IP", nil, map[string]any{"hostname": oldCollector[0].Hostname, "module": oldCollector[0].Module, "id": oldCollector[0].ID})
return nil, status.Errorf(codes.AlreadyExists, "hostname has already been registered")
}
}
Expand All @@ -39,7 +40,7 @@ func (s *Grpc) RegisterCollector(ctx context.Context, req *RegisterRequest) (*Au
collector.CollectorKey = key
err = collectorService.Create(collector)
if err != nil {
util.Logger.ErrorF("Failed to create collector: %v", err)
catcher.Error("Failed to create collector", err, nil)
return nil, err
}

Expand All @@ -49,15 +50,15 @@ func (s *Grpc) RegisterCollector(ctx context.Context, req *RegisterRequest) (*Au

err = lastSeenService.Set(key, time.Now())
if err != nil {
util.Logger.ErrorF("Failed to set last seen: %v", err)
catcher.Error("Failed to set last seen", err, nil)
return nil, err
}
res := &AuthResponse{
Id: uint32(collector.ID),
Key: key,
}

util.Logger.Info("Collector %s(%s) with id %d registered correctly", collector.Hostname, collector.Module, collector.ID)
catcher.Info("Collector was registered correctly", map[string]any{"hostname": collector.Hostname, "module": collector.Module, "id": collector.ID})
return res, nil
}

Expand All @@ -75,7 +76,7 @@ func (s *Grpc) DeleteCollector(ctx context.Context, req *CollectorDelete) (*Auth

id, err := collectorService.Delete(uuid.MustParse(key), req.DeletedBy)
if err != nil {
util.Logger.ErrorF("unable to delete collector: %v", err)
catcher.Error("unable to delete collector", err, nil)
return nil, status.Error(codes.Internal, fmt.Sprintf("unable to delete collector: %v", err.Error()))
}

Expand All @@ -87,7 +88,7 @@ func (s *Grpc) DeleteCollector(ctx context.Context, req *CollectorDelete) (*Auth
delete(s.CollectorStreamMap, key)
s.collectorStreamMutex.Unlock()

util.Logger.Info("Collector with key %s deleted by %s", key, req.DeletedBy)
catcher.Info("Collector was deleted by", map[string]any{"key": key, "deleted_by": req.DeletedBy})

return &AuthResponse{
Id: uint32(id),
Expand All @@ -102,7 +103,7 @@ func (s *Grpc) ListCollector(ctx context.Context, req *ListRequest) (*ListCollec

collectors, total, err := collectorService.ListCollectors(page, filter)
if err != nil {
util.Logger.ErrorF("failed to fetch collectors: %v", err)
catcher.Error("failed to fetch collectors", err, nil)
return nil, status.Errorf(codes.Internal, "failed to fetch collectors: %v", err)
}
return convertToCollectorResponse(collectors, total)
Expand Down Expand Up @@ -130,7 +131,7 @@ func (s *Grpc) ProcessPendingConfigs() {
if ok {
collector, err := collectorService.GetByKey(key)
if err != nil {
util.Logger.ErrorF("unable to get collector config to send config to stream : %v", err)
catcher.Error("unable to get collector config to send config to stream", err, nil)
continue
}

Expand All @@ -140,7 +141,7 @@ func (s *Grpc) ProcessPendingConfigs() {
},
})
if err != nil {
util.Logger.ErrorF("failed to send config to collector: %v", err)
catcher.Error("failed to send config to collector", err, nil)
}
}
}
Expand Down Expand Up @@ -171,7 +172,7 @@ func (s *Grpc) CollectorStream(stream CollectorService_CollectorStreamServer) er
delete(s.CollectorStreamMap, collectorKey)
s.collectorStreamMutex.Unlock()

util.Logger.ErrorF("failed to reconnect to client: %v", err)
catcher.Error("failed to reconnect to client", err, nil)
return fmt.Errorf("failed to reconnect to client: %v", err)
}

Expand All @@ -195,7 +196,7 @@ func (s *Grpc) CollectorStream(stream CollectorService_CollectorStreamServer) er

switch msg := in.StreamMessage.(type) {
case *CollectorMessages_Result:
util.Logger.Info("Received Knowlodge: %s", msg.Result.RequestId)
catcher.Info("Received Knowledge", map[string]any{"request_id": msg.Result.RequestId})

s.pendingConfigM.Lock()
if s.PendingConfigs[collectorKey] == msg.Result.RequestId {
Expand Down Expand Up @@ -223,7 +224,7 @@ func (s *Grpc) GetCollectorConfig(ctx context.Context, in *ConfigRequest) (*Coll

collector, err := collectorService.GetByKey(key)
if err != nil {
util.Logger.ErrorF("unable to get collector config: %v", err)
catcher.Error("unable to get collector config", err, nil)
return nil, status.Error(codes.Internal, fmt.Sprintf("unable to get collector config: %v", err.Error()))
}

Expand Down Expand Up @@ -251,7 +252,7 @@ func (s *Grpc) RegisterCollectorConfig(ctx context.Context, in *CollectorConfig)

err = collectorService.SaveCollectorConfigs(collectorConf, collector.ID)
if err != nil {
util.Logger.ErrorF("error saving collector configuration: %v", err)
catcher.Error("error saving collector configuration", err, nil)
return nil, status.Errorf(codes.Internal, "error saving collector configuration: %v", err.Error())
}

Expand All @@ -271,7 +272,7 @@ func (s *Grpc) ListCollectorHostnames(ctx context.Context, req *ListRequest) (*C

hostnames, _, err := collectorService.GetHostnames(page, filter)
if err != nil {
util.Logger.ErrorF("failed to fetch hostnames: %v", err)
catcher.Error("failed to fetch hostnames", err, nil)
return nil, status.Errorf(codes.NotFound, "failed to fetch hostnames: %v", err)
}

Expand All @@ -283,7 +284,7 @@ func (s *Grpc) ListCollectorHostnames(ctx context.Context, req *ListRequest) (*C
func (s *Grpc) GetCollectorsByHostnameAndModule(ctx context.Context, filter *FilterByHostAndModule) (*ListCollectorResponse, error) {
collectors, err := collectorService.GetCollectorByHostnameAndModule(filter.GetHostname(), filter.GetModule().String())
if err != nil {
util.Logger.ErrorF("unable to get hostname: %v", err)
catcher.Error("unable to get hostname", err, nil)
return nil, status.Errorf(codes.NotFound, "unable to get hostname: %v", err)
}

Expand All @@ -293,7 +294,7 @@ func (s *Grpc) GetCollectorsByHostnameAndModule(ctx context.Context, filter *Fil
func (s *Grpc) LoadCollectorsCacheFromDatabase() error {
collectors, err := collectorService.FindAll()
if err != nil {
util.Logger.ErrorF("Failed to fetch collectors from database: %v", err)
catcher.Error("Failed to fetch collectors from database", err, nil)
return err
}
for _, colect := range collectors {
Expand Down
4 changes: 2 additions & 2 deletions agent-manager/agent/ping_imp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io"
"time"

"github.com/utmstack/UTMStack/agent-manager/util"
"github.com/threatwinds/go-sdk/catcher"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand All @@ -29,7 +29,7 @@ func (s *Grpc) Ping(stream PingService_PingServer) error {
}
err = lastSeenService.Set(key, time.Now())
if err != nil {
util.Logger.ErrorF("unable to update last seen for: %s with error:%s", key, err)
catcher.Error("unable to update", err, map[string]any{"key": key})
}
}
}
Loading
Loading