I have deployed a NodeJS application to Linux App Service that logs to stderr and stdout. The diagnostic logs functionality in Linux App Service does not appear to work, as nothing appears in table storage. The only logs in Kudu are from when the docker container is deployed. After that, it logs nothing.
The SSH component in Kudu does not work, even after following the official setup documentation.
Has anyone come up with a way to capture stdout and stderr? or can recommend a library that they have gotten to work successfully with NodeJS on the Linux App Service platform?
You could use Azure CLI 2.0 to capture stdout. Try to use the following commands.
az webapp log config -g <resource group name> -n <app name> --application-logging true --detailed-error-messages true --level verbose
az webapp log tail -g <resource group name> -n <app name>
You could get help with -h
root#shui:~# az webapp log config -h
Command
az webapp log config: Configure web app logs.
Arguments
--application-logging : Configure application logging to file system. Allowed values: false,
true.
--detailed-error-messages: Configure detailed error messages. Allowed values: false, true.
--failed-request-tracing : Configure failed request tracing. Allowed values: false, true.
--level : Logging level. Allowed values: error, information, verbose, warning.
--slot -s : The name of the slot. Default to the productions slot if not
specified.
--web-server-logging : Configure Web server logging. Allowed values: filesystem, off,
storage.
More information about Azure Cli supports linux webapp please refer to this link.
Related
Is there a command to view Azure App Service Log Stream entries from the command line? I would like to tail the logs on my local console.
Yes, you can stream the Web App logs using:
az webapp log tail [--ids]
[--name]
[--provider]
[--resource-group]
[--slot]
[--subscription]
Documentation
Getting error while configuring prometheus in azure kubernetes
I tried to reproduce the same issue in my environment and got the below results
I have the cluster and I am trying to configure the Prometheus in azure Kubernetes and I got the successful deployment
To verify the agent is deployed or not use the below commands
kubectl get ds <dep_name> --namespace=kube-system
kubectl get rrs --namespace=kube-system
This error getting because of you are using the service principal instead of managed identity
For enabling the managed identity please follow the below commands
AKS cluster with service principal first disable monitoring and then upgrade to managed identity, the azure public cloud is supporting for this migration
To get the log analytics workspace id
az aks show -g <rg_name> -n <cluster_name> | grep -i "logAnalyticsWorkspaceResourceID"
For disable the monitoring use the below command
az aks disable-addons -a monitoring -g <rg_name> -n <cluster_name>
Or I can get it on portal in the azure monitor logs
I have upgrade the cluster to system managed identity, use the below command to upgrade
az aks update -g <rg_name> -n <cluster_name> --enable-managed-identity
I have enable the monitoring addon with the managed identity authentication
az aks enable-addons -a monitoring --enable-msi-auth-for-monitoring -g <rg_name> -n <cluster_name> --workspace-resource-id <workspace_resource_id>
For more information use this document for Reference
We have a Jenkins virtual machine on GCE which deals with deployments, including the ones we do to GKE. We've tried to deploy a project which we have not touched for some time. The deployment failed when calling
kubectl set image deployment my-deployment my-deployment=gcr.io/my-project/my-project:version-tag
getting this error:
Error from server (Forbidden): deployments.extensions "my-deployment" is forbidden: User "client" cannot get resource "deployments" in API group "extensions" in the namespace "default"
The weird thing is, if I log in to the machine, use my Linux user + my gcloud user, I can deploy fine. But when switching to the jenkins user using su - jenkins and then authorizing gcloud with my user I get this same error that our deploy account gets.
Please advise how to fix.
It seems related to cluster RBAC configurations. Did you enable the RBAC fo Google Groups? In this case you should follow the instructions in the documentation above or disable it.
Otherwise, ss Raman Sailopal stated, you can try this:
with your regular user run kubectl config get-contexts to retrieve your current context
copy from /home/Linux user/.kube/config to /home/jenkins/.kube/config
change user to jenkins and be sure you're using the same context by running kubectl config get-contexts and kubectl config set-context ...
try your rights with:
# Check to see if I can create deployments in any namespace
kubectl auth can-i create deployments
# Check to see if I can list deployments in my current namespace
kubectl auth can-i list deployments.extensions
I am trying to spawn the Azure Kubernetes Dashboard, using the indications found in the azure AKS
"View Kubernetes Dashboard".
In particular I get
az aks browse --resource-group my-resource-group --name aks-name-westeurope-001
By default it spawns a port redirection to port 8001, that unfortunately is already used, so I get
F0716 12:08:13.743013 11860 proxy.go:160] listen tcp 127.0.0.1:8001: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
How can I change the port so that I can login to my kubernetes dashboard ?
After some attempts I figured it out, but I couldn't find anything like this on SO, so I copy my solution here.
If I ran az aks browse --help I get the following indication
Command
az aks browse : Show the dashboard for a Kubernetes cluster in a web browser.
Arguments
--name -n [Required] : Name of the managed cluster.
--resource-group -g [Required] : Name of resource group. You can configure the default group
using `az configure --defaults group=<name>`.
--disable-browser : Don't launch a web browser after establishing port-forwarding.
Add this argument when launching a web browser manually, or for automated testing.
--listen-address : The listening address for the dashboard. Default: 127.0.0.1.
Add this argument to listen on a specific IP address.
--listen-port : The listening port for the dashboard. Default: 8001.
Add this argument when the default listening port is used by another process or unavailable.
Global Arguments
--debug : Increase logging verbosity to show all debug logs.
--help -h : Show this help message and exit.
--only-show-errors : Only show errors, suppressing warnings.
--output -o : Output format. Allowed values: json, jsonc, none, table, tsv,
yaml, yamlc. Default: json.
--query : JMESPath query string. See http://jmespath.org/ for more
information and examples.
--subscription : Name or ID of subscription. You can configure the default
subscription using `az account set -s NAME_OR_ID`.
--verbose : Increase logging verbosity. Use --debug for full debug logs.
That means that running my command with the extra parameter --listen-port makes the trick
az aks browse --resource-group my-resource-group --name aks-name-westeurope-001 --listen-port 10000
Is it possible to exec a command in a windows container related to a webapp based on a container? I'm not able to find the right name to use on the cli command az app exec. In fact az container list returns me an empty list. However the container exits cause the web app is running. Where can I find the right name to use with az app exec command? I also checked with the name of only one slot in the webapp without success.
The error az app exec returns is:
The Resource 'Microsoft.ContainerInstance/containerGroups/theNameIPRovide' under resource group 'thegroupNameIProvide' was not found.
Unfortunately, there is no Azure CLI command for Web app for Container to exec the command inside the container. But you can use other ways, for example, the API.
There is no CLI command like az app exec. And az container is for ACI, not for the Web App. You can get all CLI command for Web App in az webapp.
Or you can deploy your application in Azure Container Instance, it also can run windows container for you. So that you can use the CLI command az container exec to execute the command inside your application.
Could you have a look at this https://learn.microsoft.com/en-us/cli/azure/container?view=azure-cli-latest#az-container-exec, Couldnt comment, so had to post it in an answer