Skip to content
Icon

worker Application Error Monitor

Profile Avatar

Icon 1 3 Troubleshooting Commands

Icon 1 Last updated 13 weeks ago

Icon 1 Contributed by jon-funk



Troubleshooting Commands

Get worker Application Logs

What does it do?

This command uses kubectl to access logs from a specific context and namespace based on specified labels, displaying only the latest lines of logs within certain size and time limitations for a specific container.

Command
kubectl --context=gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -n voting-app logs -l app=worker --tail=500 --limit-bytes=256000 --since=60m --container=worker
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# Set the Kubernetes context to the specified context
kubectl config use-context ${CONTEXT}

# View logs from a specific namespace using the -n flag
# Replace ${NAMESPACE} with the name of the namespace you want to view logs for
kubectl -n ${NAMESPACE}

# Filter logs based on labels using the -l flag
# Replace ${LABELS} with the labels you want to filter by
logs -l ${LABELS}

# Specify the maximum number of lines of log output to show using the --tail flag
# Replace ${MAX_LOG_LINES} with the maximum number of lines you want to display
--tail=${MAX_LOG_LINES}

# Limit the log output in bytes using the --limit-bytes flag
# Replace 256000 with the maximum number of bytes you want to display
--limit-bytes=256000

# Show logs since a specific timestamp using the --since flag
# Replace ${LOGS_SINCE} with the timestamp you want to view logs since
--since=${LOGS_SINCE}

# View logs from a specific container using the --container flag
# Replace ${CONTAINER_NAME} with the name of the container you want to view logs for
--container=${CONTAINER_NAME}
Helpful Links

Tail worker Application Logs For Stacktraces

What does it do?

This command is a placeholder for a specific system command or script that needs to be executed within a larger program or script. It allows for the dynamic execution of commands based on specific conditions or inputs.

Command
${cmd}
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# This is a multi-line command with helpful comments
# First, we want to declare a variable called cmd and assign it a value

cmd="some_command --option1 value1 --option2 value2"

# Next, we want to execute the command stored in the cmd variable.
# By using the ${} notation, we can reference the value of the variable.

${cmd}
Helpful Links

Tail worker Application Logs For Stacktraces

What does it do?

This command is a placeholder for a specific system command or script that needs to be executed within a larger program or script. It allows for the dynamic execution of commands based on specific conditions or inputs.

Command
kubectl --context=gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -n voting-app exec $(kubectl --context=gke_runwhen-nonprod-sandbox_us-central1_sandbox-cluster-1-cluster -n voting-app get all -l app=worker -oname | grep -iE "deploy|stateful" | head -n 1) --container=worker -- ps -eo command --no-header | grep -v "ps -eo"
IconCopy to clipboard Copied to clipboard

Learn more

This multi-line content is auto-generated and used for educational purposes. Copying and pasting the multi-line text might not function as expected.

# This is a multi-line command with helpful comments
# First, we want to declare a variable called cmd and assign it a value

cmd="some_command --option1 value1 --option2 value2"

# Next, we want to execute the command stored in the cmd variable.
# By using the ${} notation, we can reference the value of the variable.

${cmd}
Helpful Links