I have deployed a php application to google app engine. I can access the application using the url: http://project-id.appspot.com. Since, I have integrated log4php in my application, I want to access the log files of the application using putty or winscp(sftp). How can I access the files deployed on the server ?
Thanks
Take a look at "Reading and Writing Application Logs. If you log in the correct manner, logs are viewable in the Cloud Console or by using the gcloud app logs read command.
Yes, we can use Logs PHP API to write and read logs. But I chose to configure log4php to log into the database.
Thanks
Related
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.
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
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.
I'm trying to deploy Question2Answer (Q2A) by following this official install guide - where we need to set up
A web server to push Q2A source code to - uploading application folder to App Engine instance matched with this.
A MySQL database and the according log-in account - this is matched by creating and configuring a Cloud SQL instance to work with our app engine instance.
Though I failed to get Q2A run on Google's cloud - as browing the deployed web I get the error as below snapshot.
How would you guys get it deployed successfully?
p.s.
Steps I have made to Q2A's PHP source code
Entering MySQL database access credentials (by following this guide)
Adding app.yaml file so as Google App Engine SDK would deploy Q2A application
The Q2A source code folder I'm working with is as below.
You just need to remove the root password and leave it like this:
define('QA_MYSQL_PASSWORD', '');
You can find at the documentation that "when you connect from App Engine, you can use the root user and no password"
Hope it helps.
Could I call "mkdir" function with Google app engine for PHP SDK?
I have tried with the living GAE for PHP, seems failed to create the directory.
You can't create directory during runtime on GAE.
Take a look at the GAE's introduction. In the The Sandbox paragraph, it says:
Applications cannot write to the file system in any of the runtime
environments. An application can read files, but only files uploaded
with the application code. The app must use the App Engine datastore,
memcache or other services for all data that persists between
requests.
I think that's why you failed to create the directory.