-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from levoai/extract-satellite-logs
Adding script to extract satellite logs
- Loading branch information
Showing
6 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,18 @@ description: Install Levo.ai Satellite on Kubernetes. Follow our detailed guide | |
|
||
# Satellite on Kubernetes | ||
|
||
import BrowserOnly from '@docusaurus/BrowserOnly'; | ||
|
||
export function DownloadGetLogsScript() { | ||
return ( | ||
<BrowserOnly fallback={<div>Loading...</div>}> | ||
{() => ( | ||
<a href={window.location.protocol + '//' + window.location.host + '/artifacts/satellite/get_levoai_satellite_logs.sh'} download> download</a> | ||
)} | ||
</BrowserOnly> | ||
); | ||
} | ||
|
||
## Setup | ||
|
||
### Prerequisites | ||
|
@@ -336,5 +348,13 @@ kubectl -n levoai logs <levoai-tagger-pod-id> | grep "ConnectionRefusedError: [E | |
|
||
If there are exception messages, Tagger is unable to connect to dependent services. It generally establishes connection after 3/4 retries. Please contact [email protected] for further assistance. | ||
|
||
<br></br> | ||
### Share Satellite logs with Levo Support | ||
|
||
Please <DownloadGetLogsScript/> script and execute following commands to collect logs from all Satellite components. This will create an archive as `/tmp/levoai_satellite_logs_%date-time%.tar.gz`. | ||
|
||
```bash | ||
chmod +x get_levoai_satellite_logs.sh | ||
./get_levoai_satellite_logs.sh | ||
``` | ||
|
||
<br></br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check if kubectl is installed | ||
if ! command -v kubectl &> /dev/null; then | ||
echo "Error: kubectl is not installed or not found in your PATH. Please install kubectl and try again." | ||
exit 1 | ||
fi | ||
|
||
# Validate if there is an active Kubernetes context | ||
CURRENT_CONTEXT=$(kubectl config current-context 2>/dev/null) | ||
|
||
if [ -z "$CURRENT_CONTEXT" ]; then | ||
echo "Warning: No active Kubernetes context found. Please configure your kubeconfig and try again." | ||
exit 1 | ||
fi | ||
|
||
echo "Active Kubernetes context: $CURRENT_CONTEXT" | ||
|
||
# Set the namespace (default to "levoai" if not provided as an argument) | ||
NAMESPACE=${1:-levoai} | ||
|
||
echo "Checking for pods in $NAMESPACE namespace.." | ||
|
||
# Check if the namespace exists and has pods | ||
PODS=$(kubectl get pods -n "$NAMESPACE" --no-headers -o custom-columns=":metadata.name") | ||
|
||
if [ -z "$PODS" ]; then | ||
echo "Warning: No pods found in namespace '$NAMESPACE' in the current context." | ||
exit 1 | ||
fi | ||
|
||
# Create a temporary directory to store logs | ||
TEMP_DIR=$(mktemp -d) | ||
echo "Temporary directory created: $TEMP_DIR" | ||
|
||
# Loop through each pod and save its logs into separate files | ||
for POD in $PODS; do | ||
LOG_FILE="$TEMP_DIR/${POD}.log" | ||
echo "Collecting logs for pod: $POD" | ||
kubectl logs "$POD" -n "$NAMESPACE" > "$LOG_FILE" 2>&1 | ||
done | ||
|
||
# Create archive of current directory | ||
TAR_FILE="/tmp/levoai_satellite_logs_$(date +%Y_%m_%d_%H_%M_%S).tar.gz" | ||
tar -czf "$TAR_FILE" -C "$TEMP_DIR" . | ||
|
||
echo "Logs have been collected and archived at $TAR_FILE" | ||
|
||
# Clean up temporary directory | ||
rm -rf "$TEMP_DIR" | ||
|
||
|