Enable log collection to route Argo CD control plane logs and audit logs of the Argo CD server to Simple Log Service (SLS) for troubleshooting and compliance auditing. The Argo CD control plane consists of the Argo CD server and the Argo CD application controller.
Billing
Storing logs in Simple Log Service incurs pay-as-you-go charges. For details, see Pay-by-feature.
Prerequisites
Before you begin, ensure that you have completed Collect control plane logs and audit logs from a Fleet instance.
Enable log collection
Run the following command to create an AliyunLogConfig resource.
The project field is optional. If you omit it, the log controller automatically creates a project named k8s-log-\<clusterid\> and a Logstore named gitops-argocd-logstore to store the Argo CD control plane logs. To use a custom project name, set the project field to the name you want — the log controller creates the project if it does not exist.
cat << EOF | kubectl apply -f -
apiVersion: log.alibabacloud.com/v1alpha1
kind: AliyunLogConfig
metadata:
name: gitops-argocd-sls-config
namespace: argocd
spec:
# Optional: specify a custom SLS project name.
project: ackone-gitops
# Log retention period in days. Adjust based on your requirements.
lifeCycle: 5
logstore: gitops-argocd-logstore
logtailConfig:
inputType: plugin
configName: gitops-argocd-sls-config
inputDetail:
plugin:
inputs:
- detail:
Stderr: true
Stdout: true
type: service_docker_stdout
EOFDisable log collection
Delete the AliyunLogConfig resource:
kubectl delete aliyunlogconfigs.log.alibabacloud.com gitops-argocd-sls-config -n argocdLog on to the Simple Log Service console and delete the Logstore gitops-argocd-logstore.