Skip to content

Commit

Permalink
Add more log files in diagnostic logs (#1565)
Browse files Browse the repository at this point in the history
Fix logrotate cron job
  • Loading branch information
ramanan-ravi authored Sep 13, 2023
1 parent f825af4 commit 21c9e9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions deepfence_agent/start_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,19 @@ check_options() {
done
}

launch_system_services() {
configure_cron() {
#Setup cron jobs for misc tasks, it needs to be killed and restarted
#doesnt work smoothly inside docker!
service cron start >/dev/null &

service cron start
chmod 600 /etc/logrotate.d/fenced_logrotate.conf
line="*/5 * * * * /usr/sbin/logrotate /etc/logrotate.d/fenced_logrotate.conf"
(echo "$line") | crontab -
(echo "") | crontab -
(echo "*/5 * * * * /usr/sbin/logrotate /etc/logrotate.d/fenced_logrotate.conf") | crontab -
}

launch_deepfenced() {
# In k8s, if agent pod restarts these files are not cleared
rm -rf /var/log/fenced/* 2>/dev/null
mkdir -p /var/log/fenced/malware-scan /var/log/fenced/malware-scan-log /var/log/fenced/secret-scan /var/log/fenced/secret-scan-log /var/log/fenced/compliance /var/log/fenced/compliance-scan-logs 2>/dev/null
launch_system_services
configure_cron
if [[ -z "${SCOPE_HOSTNAME}" ]]; then
SCOPE_HOSTNAME="$(hostname)"
export SCOPE_HOSTNAME="$SCOPE_HOSTNAME"
Expand Down
4 changes: 2 additions & 2 deletions deepfence_bootstrapper/controls/controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func SetClusterAgentControls(k8sClusterName string) {
func(req ctl.SendAgentDiagnosticLogsRequest) error {
log.Info().Msg("Generate Cluster Agent Diagnostic Logs")
return SendAgentDiagnosticLogs(req,
[]string{"/var/log/supervisor", "/var/log/compliance/compliance-status"},
[]string{"/var/log/supervisor", "/var/log/fenced/compliance-scan-logs", "/var/log/deepfenced"},
[]string{})
})
if err != nil {
Expand Down Expand Up @@ -129,7 +129,7 @@ func SetAgentControls() {
func(req ctl.SendAgentDiagnosticLogsRequest) error {
log.Info().Msg("Generate Agent Diagnostic Logs")
return SendAgentDiagnosticLogs(req,
[]string{"/var/log/supervisor", "/var/log/fenced"},
[]string{"/var/log/supervisor", "/var/log/fenced", "/var/log/deepfenced"},
[]string{"/var/log/fenced/compliance/", "/var/log/fenced/malware-scan/", "/var/log/fenced/secret-scan/"})
})
if err != nil {
Expand Down

0 comments on commit 21c9e9a

Please sign in to comment.