How to enable custom PHP laravel logging for Azure log analytics - php

We have developed a PHP application and hosted the same in Azure Webapp with Linux as the operating system.
Currently the log files are getting generated inside the wwwroot/storage/logs as shown in attached ssh console app screenshot.
We have enabled the Custom logs for the App Service from Log Analytics as shown in log analytics screenshot. (I was unable to understand whether path should be given from home or site so I added both).
When I tried to query the custom log in the Azure Log it is returning empty data. Please find the attached screenshot for reference log image
Please help me in understanding what is the mistake.
Thank you.

Your app needs to be running in a VM to use Custom Log Analytics in that manner. Just ensure you've properly installed and configured the OMS agent according the steps documented in https://learn.microsoft.com/en-us/azure/azure-monitor/platform/data-sources-custom-logs.
Since you're using an App Service, there isn't Custom Log Analytics available. There is, however, Log Analytics integration for App Services which is currently in preview and supports the following types:
AppServiceHTTPLogs
AppServiceConsoleLogs
AppServiceAppLogs
AppServiceFileAuditLogs
AppServiceAuditLogs
You can also leverage this SDK to write your custom log messages to application insights.

Related

Azure portal Web Service PHP Monitoring

I wrote a simple Application in HTML with a form. I submit the form into a PHP file and insert the data into a database.
I created an App Service on Azure Portal + MySQL database
It took me a while to get the git Pipeline going (So Git - Azure Portal - deploying into a Webservice)
If I submit my form, the data will go to the database just fine.
Now I wanted to extend everything with a monitoring tool. So I tried Application Insights. But unfortunately, that doesn't work. If I understand it correctly it's because of the PHP file or to be exact the Php Stackruntime on Azure.
Is it possible to the monitoring anyway somehow? I only have experience in Php and Html a little bit of Java and Javascript.
Thanks.
I have deployed sample PHP App to Azure App Service.
So I tried Application Insights. But unfortunately, that doesn't work.
I have checked with both PHP 8.0 and 8.1 runtime version. The Application Insights option is disabled for PHP.
Thanks #Dmitry-Matveev for the Application Insights SDK.
Is it possible to the monitoring anyway somehow?
Check the below steps to Monitor Azure PHP App Service.
Way 1:
Check the Logs under Monitoring.
Way 2:
Enable Application logging (File System).
Navigate to the Log stream to check the Live metrics.
Also, we can check the metrics section to monitor the App.

How to integrate Laravel app with Azure Monitor Logs

I have Laravel application runs on an azure VM and I would like to send app logs to Azure Monitoring Logs instead of use the traditional log file.
I have checked this documentation https://learn.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-custom-logs but it also depends on custom log file.
Is there any other solutions to send logs directly to azure?
For monitoring application data, we use azure application insights service. However, currently the instrumentation is available only few languages as stated
in this document (https://learn.microsoft.com/en-us/azure/azure-monitor/app/platforms#unsupported-community-sdks)
Alternatively, you can use Open Telemetry in PHP which is a observability framework – an API, SDK, and tools that are designed to aid in the generation and collection of application telemetry data such as metrics, logs, and traces which is not currently in production.
You can also leverage the below SDK to write your custom log messages to application insights.
https://github.com/Microsoft/ApplicationInsights-PHP
https://github.com/provisions-group/ms-application-insights-laravel

PHP Hello Analytics Reporting API V4 with OAuth 2.0

I am trying to access the Google Analytics API for web applications using PHP, like described in this tutorial: https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-php
I have followed all the steps precisely, however was not been able to make it running. I have managed to debug so far that I found out about where the problem is.
When OAuth consent screen pops up and I click Allow, application does not get authorized. I just keep seeing the same popup. Also, if I check authorized apps in my google account, it is not listed there.
Another interesting fact is that Hello Analytics Reporting API V4 using JavaScript is working just fine.
https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-js
Does anybody have a clue about what could be wrong with my app authorization?
OK, now I have additionally discovered it has something to do with localhost. Once I have uploaded the same code to live server, it is working just fine. But I cannot get it working on locahost. Does anybody have an idea how to setup Credentials or whatever to make it working in development environment (localhost)?
Check your browser extensions (i.e. Disconnect) may be blocking the auth token.

How to access Google Play Android Developer API through backend server

I am implemented In App Billing for android.I wanted to implement subscription validity checking through my backend server. As Google Play Documentation, for making call for Google Play API,need authentication using oauth 2.0.
I followed instructions for registering project and creating credentials. But from there I have no idea how to use those credentials, I tried authentication via CURL request, but it asking permission as shown in follwing image
This permissions works fine I can exchange code and get access token, but all this done by manually, how should I implement this on backend.
I even try to use google api php library provided by Google, but It adds confusion. Also they didn't provide any example, how to use library.
Can anybody elaborate how exactly use library or pure php?
Thanks in advance.
To perform LVL and/or IAB validation on a server, do not access Google servers directly from the server. Even if all information were available, you would face integrity problems, because your app and your server will see different information due to synchronization latencies.
Instead, use your app as a proxy and validate the Google Play information on your server as described here.

Creating an azure php web role

I have somewhat successfully followed this tutorial:
http://blogs.msdn.com/b/silverlining/archive/2012/06/21/creating-a-php-web-role-in-windows-azure.aspx
However I am stuck. I am not entirely sure how to create an instance in the azure management portal, after I have set up the web role on my local machine.
There are currently no instances set up. When I try to set them up, it asks me to upload a package and configuration file. Where can I find these.
Thanks
This should be a comment on your question but I can't make comments yet.
When creating a new cloud service do not check the box "Deploy a cloud service package."
If you use + -> Compute -> Cloud Service -> Quick Create it won't ask for a package either.
Once it's done being created you can open it up to download the credential file for Power Shell.

Categories