Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more log files in diagnostic logs #1565

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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