The aks-logs
tool will help you to query the Container logs running inside the Azure Kubernetes Service cluster.
-
Download
curl -LO https://github.com/Mirage20/aks-logs/releases/latest/download/aks-logs-linux-x64.tar.gz
-
Extract
tar -xzvf aks-logs-linux-x64.tar.gz
-
Install
sudo mv ./aks-logs /usr/local/bin/aks-logs
-
Download
curl -LO https://github.com/Mirage20/aks-logs/releases/latest/download/aks-logs-darwin-x64.tar.gz
-
Extract
tar -xzvf aks-logs-darwin-x64.tar.gz
-
Install
sudo mv ./aks-logs /usr/local/bin/aks-logs
-
Execute
aks-logs
command with required flags# Check logs for my-service workload aks-logs -subscriptionId=00000000-0000-0000-0000-000000000000 \ -resourceGroupName=my-res-group -clusterName=cluster-1 \ -namespace=default -workloadName=my-service -containerName=my-service
-
Run
aks-logs --help
for more informationUsage of aks-logs: -clusterName string AKS Cluster name. Required -containerName string Container name of the Kubernetes workload. Required -contains string Filter log entries by list of contents if specified. Example: -contains=val1,val2 -endTime string End time of the log entries. Default to (current time) if not specified. Format: 2006-01-02T15:04:05.999999999+07:00 -maxRecords int Maximum number of log entries to query. Default to 1000 -namespace string Kubernetes namespace of the workload. Required -resourceGroupName string Resource group name of the AKS Cluster. Required -showDescending Output the logs in descending order based on generated time -showQuery Output the Kusto query -showRaw Output the raw results -startTime string Start time of the log entries. Default to (current time - 24h) if not specified. Format: 2006-01-02T15:04:05.999999999+07:00 -subscriptionId string Subscription id of the AKS Cluster. Required -version Output version information -workloadName string Kubernetes workload name. Required