Azure App Services
A feature of Azure App Service used to create and deploy scalable, mission-critical web apps.
4,555 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Team,
I need to host a .net core web api as app service in azure. Is it mandatory to enable file system option to view console logs. This option will any way work for 12 hours and not recommended in production then how could we see our logs. I have used only console log provider in my application. Is there any way to view logs on some console rather than saving in the file.
How can we get the console like in linux based systems or kubernetes.
Thank you
@Jerry Cai-MSFT , Hello. But how it can suffice the problem. Either,
If azure has the option of API App as well in the app services then we can expect that it providing a medium to host microservices, rest services etc. In .net core or python or golang etc there are millions of logs we prefer to throw only on STDOUT console rather than saving in a file system.
How to get that console in azure. Paying only for console logs is little difficult to digest. Don't you think it as a very important feature missing in azure app services.
@Tanul , It's a good feedback. Appreciate your feedback!
Based on similar users feedback on (Uservoice’ (Azure Web Apps) Please add a setting to persist the application log)- Azure monitor integration feature was released. You can use the Azure Monitor integration (Preview) to route your logs to an Azure Storage Account, Event Hub, or Log Analytics workspace. Persisting all logs on the file system indefinitely would fill your app’s file system eventually.
Supported log types (related): AppServiceConsoleLogs, AppServiceHTTPLogs, AppServiceAppLogs etc.
Kindly check this App Service Integration with Azure Monitor (Preview). It's still in preview, please do share your feedback on this below, we shall relay this to our product team.
@ajkuma , Thank you for sharing. But the problem is still the same. To use this feature we have to select either of these options
All of these requires extra cost. Does azure do not support microservices concepts. I don't think this is true. Azure has given an api app option explicitly for the web services only. If .net core/python is supported then why do we have to pay extra for simple debug console logs. For exception logs we can explore other resources like writing into object storage or to a file. But simple console logs are not that critical.
I would be grateful if you can think on this because deploying as an app service or deploying kubernetes then app into it is like comparing apple with oranges i.e. only for few non critical logs.
And one thing we cannot deny is real time console logs is one of the most beautiful feature of such new upcoming scripting languages. This is one of the major reason why .net core/python/go lang is preferred over other framework technologies. Even kubernetes guide says STDOUT is one of the good design pattern for real time logging.
@Jerry Cai-MSFT , @ajkuma , Truly appreciate if you please suggest something else here. Thank you
@Tanul , Having mentioned above, I have shared your feedback with the product team internally and will post back as soon as I hear more from them. If you wish you may also share your suggestion here on Uservoice.
Again, much appreciate your valuable feedback on this.
Sign in to comment
@Tanul , With the curl itself, you can scope the live traces to any providers/folders, you may additional specify the path.
Kudu service (as well as its application) write traces to the /Logfiles folder. The logstream endpoint (/logstream in the Kudu service) enables you to view with any real time traces as they are being written.
/api/logstream/kudu/trace => kudu related traces intended for diagnostic kudu issues.
/api/logstream/kudu/deployment => kudu deployment traces intended for application developers/operators.
/api/logstream/application => application traces.
/api/logstream/http => iis logs.
Kindly see this Diagnostic Log Stream for more details.
Yes, you can change DIAGNOSTICS_TEXTTRACETURNOFFPERIOD to a value greater than 12 hours (12 * 60 * 60 * 1000 in milliseconds) based on your requirement (considering the space).
@ajkuma , Done. Thanks a lot for the details. I'll make file logs for fatal errors only and enable debug logs only in case of troubleshooting. Will use kudu stream for here.
Thanks a lot once again. Have a great day and happy new year.
@Tanul , Glad you found the information helpful. Thanks for the update and your best wishes. A Very Happy New Year to you!
Sign in to comment
4 additional answers
Sort by: Most helpful
@Tanul , Just to add more clarity
Failure to disable the
stdout log
can lead to app or server failure. There's no limit on log file size or the number of log files created. So it is recommended to only usestdout
logging to troubleshoot app startup problems and disable stdout logging when troubleshooting is complete by setting stdoutLogEnabled="false".For general logging in an ASP.NET Core app after startup, use a logging library that limits log file size and rotates logs. For more information, see third-party logging providers.
We avoid any feature that involves writing to the app's file system in a continuous manner, which can degrade performance.
Kindly refer Logging in .NET Core and ASP.NET Core doc for more details.
@ajkuma , Sorry to say but how it cannot be a recommended approach. Today, whole devops model is depending upon STDOUT logs. Majority of golang/python applications are depending upon STDOUT. I don't know why microsoft is not recommending it.
Could you please share the complete technical reason behind that.
The app logs are not indefinitely stored on the WebApps because your application is stored on the same storage, having constant increasing of logs on the site would strain the system.
Any app needs storage to hold content (HTML, .js files, images, or code files, and any other content required) for the application to work. A file server mounts Azure Storage blobs and exposes them as network drives to the Worker. A Worker, in return, maps such network drives as local, allowing any application running on any given Worker to use the “local” drive, just like you would expect if the application were running on a server using its local disk. Any file-related read/write operation performed by the application passes through a file server.
Kindly see this doc Operating system functionality on Azure App Service for more details on this :
@Tanul , Also, kindly see Inside the Azure App Service Architecture - This article covers the basic internal architecture of App Service (how the service is built and operates) and offers a few best practices for certain scenarios.
Sign in to comment
@Tanul ,
You're limited to a maximum of 100 megabytes of logs when you use the file system. (File system logs are only for short-term retention. Azure deletes old log files to make room for new ones after the limit is reached.)
In cases when configuring logs to go to File System/, they go to a different LogFiles folder: D:\home\LogFiles\SiteExtensions\Kudu. If you need to stream them, you can run (log in with your deployment credentials):
Or if using Azure site log tail (which wraps the same API), pass -p SiteExtensions/Kudu to tell it to stream from that path.
Timeout in milliseconds to keep application logging on (Default is 43200000, which is 12 hours) is on the app:
https://github.com/projectkudu/kudu/wiki/Configurable-settings#diagnostics-related-settings
Sign in to comment
@ajkuma , Please correct me if I'm wrong. So we've 2 options here. Save the log files let say using any 3rd party logger in some folder for eg. D:\home\LogFiles\somedirectory\mylogs
Now, if we need to access it then we can open kudu portal and check the logs manually.
Secondly, if we need to use the azure log stream feature for STDOUT logs then firstly, we have to enable azure application log file system option. To increase that default 12 hours period we have to create this variable in app settings and specify the value.
DIAGNOSTICS_TEXTTRACETURNOFFPERIOD
And, once the time expires I have to manually enable it again.
If we need to access stdout logs then we can fire the curl command like this or use log stream tab in azure(default place for logs is D:\home\LogFiles\SiteExtensions\Kudu)
Am I correct here or mixed-up the steps. Could you please confirm.
Sign in to comment
Hi @Tanul
You can try enabling logging features and later use Kudo to view logs.Some minor cost for using storage to store file but still you can always limit.
Azure Monitor integration to route your logs to an Azure Storage Account or Log Analytics workspace. Persisting all logs on the file system indefinitely would fill your app’s file system eventually.
https://azure.github.io/AppService/2019/11/01/App-Service-Integration-with-Azure-Monitor.html
Kudo Steps :: https://learn.microsoft.com/en-us/learn/modules/capture-application-logs-app-service/
http://sitecore.skowronski.it/sitecore/how-to-get-the-latest-logs-from-azure-with-kudu/
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs#enable-web-server-logging
(Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members. Thank You)
Regards,
J.D.
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.
Sign in to comment
Activity