diff --git a/agent.go b/agent.go index 0e5b5e3..c8e02b4 100644 --- a/agent.go +++ b/agent.go @@ -66,9 +66,11 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, apiclient := &ApiClient{Client: &http.Client{}, APIURL: config.APIURL} // TODO: pass in an iowriter/ use log library - WriteLog(fmt.Sprintf("read config %v", config)) + WriteLog(fmt.Sprintf("read config \n %v", config)) + WriteLog("\n") WriteLog(fmt.Sprintf("%s %s", StepSecurityLogCorrelationPrefix, config.CorrelationId)) + WriteLog("\n") Cache := InitCache(config.EgressPolicy) @@ -125,6 +127,7 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, return err } + WriteLog("\n") WriteLog("updated resolved") // Change DNS for docker, causes process in containers to use agent's DNS proxy @@ -134,7 +137,8 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, return err } - WriteLog("set docker config") + WriteLog("\n") + WriteLog("set docker config\n") if config.EgressPolicy == EgressPolicyAudit { netMonitor := NetworkMonitor{ @@ -159,7 +163,9 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, WriteLog("added audit rules") } else if config.EgressPolicy == EgressPolicyBlock { + WriteLog("\n") WriteLog(fmt.Sprintf("Allowed domains:%v", config.Endpoints)) + WriteLog("\n") netMonitor := NetworkMonitor{ CorrelationId: config.CorrelationId, @@ -206,6 +212,7 @@ func refreshDNSEntries(ctx context.Context, iptables *Firewall, allowedEndpoints case <-ctx.Done(): return case <-ticker.C: + WriteLog("\n") WriteLog("Refreshing DNS entries") for domainName, endpoints := range allowedEndpoints { element, found := dnsProxy.Cache.Get(domainName) diff --git a/eventhandler.go b/eventhandler.go index edd168b..999de16 100644 --- a/eventhandler.go +++ b/eventhandler.go @@ -41,6 +41,7 @@ func (eventHandler *EventHandler) handleFileEvent(event *Event) { } if strings.Contains(event.FileName, "post_event.json") { + WriteLog("\n") WriteLog("post_event called") // send done signal to post step diff --git a/log.go b/log.go index 2c26108..2d35241 100644 --- a/log.go +++ b/log.go @@ -22,7 +22,7 @@ func WriteLog(message string) { if message == "\n" { f.WriteString(fmt.Sprintf("\n")) } else{ - f.WriteString(fmt.Sprintf("%s:%s\n", time.Now().String(), message)) + f.WriteString(fmt.Sprintf("%s:%s\n", time.Now().Format("Mon, 02 Jan 2006 15:04:05 MST"), message)) } diff --git a/procmon_linux.go b/procmon_linux.go index 128477c..4d5a1bc 100644 --- a/procmon_linux.go +++ b/procmon_linux.go @@ -17,6 +17,7 @@ import ( ) func (p *ProcessMonitor) MonitorProcesses(errc chan error) { + WriteLog("\n") WriteLog("Monitor Processes called") client, err := libaudit.NewAuditClient(nil) @@ -104,6 +105,7 @@ func (p *ProcessMonitor) MonitorProcesses(errc chan error) { } WriteLog("receive called") + WriteLog("\n") p.receive(client) }