How to view application logs compute engine in google cloud - java

I am new to google cloud. I have a java application and I write logs in my compute engines storage itself.
That is I have a log folder inside my e2-small machine and I have log files in that folder.
I can ssh to my compute engine and view logs but want to explore how to use google cloud tools for same.
I have explored
https://cloud.google.com/logging/docs/view/logs-viewer-interface
https://cloud.google.com/appengine/docs/standard/nodejs/building-app/viewing-service-logs
and also few stackoverflow questions.
Right now is view audit events for my compute engine like (Removing user viraj and Updating keys for user viraj)
Please let me know if any more information is required or if I am missing in my cloud setup?

As mentioned by #YariPelona, there's a post with a similar question at the post: How to logging python script log into Google stackdriver logging running on a Google Cloud VM.
The tool that will help you is Cloud Logging, which will allow you to see your logs in a Log Explorer ans setup custom monitoring depending on your app/project needs by installing the Monitoring agent, which includes setup guides for such monitoring at several 3rd party apps.
Find the guide to install, configure and authorize the monitoring agent in This link:
Installing the agent on a single VM
Then you can go to this link to find out how to use Cloud Loggin and see your logg in the Log Explorer by enabling it on your VM instance or using Cloud Shell with gcloud commands:
Quickstart using Logging tools.
And last but not least, in the next link you will find the Guides to monitor third-party applications like Apache web server, MySql, Cassandra, Tomcat, etc (Plugin enablement), with the tools mentioned above:
Monitoring third-party applications

Related

Actions On Google Deployment using webhook

I am using Java Client Library to use google Dialogflow. My questions is what happens when we use "appEnginedeploy" using gradle? Where is the code stored and more importantly how the implemented database and other files of code stored and accessed by our agent?
Thanks!
appEngineDeploy is setup to deploy the code to App Engine, a computing platform on Google Cloud. Code and associated project files are stored as they are in your project.
It's not entirely a VM, so you shouldn't necessarily think of App Engine as locating filepaths. If the project can make the links locally, then it should behave the same way in App Engine.
With regards to databases, it would depend if you're using an embedded database or using a hosted solution through another Google Cloud service. Presumably you'd use the database APIs for a Cloud service as shown in the documentation.

Filter entities in Development console

To add some context I use App Engine Java SDK:
Run sever with mvn appengine:devserver
Browse Datastore entities in localhost:8080/_ah/admin.
In Google Cloud Console the Datastore entities can be filtered by key; but when testing the application locally I didn't find a way to do so and have to skip through multiple pages.
Is there anything similar that I can use on the Local Development Server?
For any of you who are interested in development of this feature, there is an issue opened for this in the Google's Public Issue tracker.

deploying java plugins in cloud foundry

I have deployed few apps in cloud foundry and i want to see the CPU usage and Memory consumption etc like we see through Jprofile,JMX etc.
So can i deploy them as a plugin in my space if so - what are the steps.
not expecting a full length answer you can give some blog url or reference.
is deploying a plugin is same as application deployment.
Any other way to see the usage .
Because cloud foundry provider shows very basic usage in numbers but what i want is a graphical interface.
Any hint on this.
To monitor Pivotal Cloud Foundry, there are multiple tools available.
For platform monitoring you can use PCF Metrics, Data Dog, New Relic, Prometheus + Grafana.
Most of these do need the JMX Bridge tile installed.
For app performance monitoring you can install or setup tools like New Relic or App Dynamics. You will have to pay for these tools.
Register with network.pivotal.io. Sign in and you will get a list of all tiles from Pivotal and 3rd party vendors.

How to upload Servlet/JSP website through Amazon Web Services?

I am working on a Servlet/JSP project and I want to host it on aws.amazon.com. I have already signed up for Amazon Web Services and after signing in this page opens up and I have no idea what to do or which option to select.
I think AWS provides a lot of customization with a lot advanced technical options to choose from, but this is difficult for beginners who just want to make their site running.
My project will use these:-
JSP/Servlets
CSS
MySQL
Struts2
Tomcat WebServer
I would suggest these approaches to study:
Elastic BeanStalk - This is AWS simply hosting model. If you're not IT savy you should pursue this approach
EC2 with MySQL RDS - In this case you'll create a Virtual Machine(s) (EC2) install Tomcat and other dependencies and deploy your app. You'll then use RDS to store your data (which is MySql as a service)
EC2 only - YOu'll do the same as 2. but install your own instance of MySql. There may be AMI's offered that you can provision that will meet your application requirements.
Other reading:
Route53 if your going to use AWS for your domain records
Elastic Load Balancing if your going to need High Availability
Elastic Block Store if you want persistent disks accross VMs
Network Security Groups to secure your VMs (for 1. and 2.)
Virtual Private Cloud for additional security
CloudFormation if you want to automate provisioning
There are many articles on: AWS Architecture
There is a eclipse plugin for Amazon web services.
The AWS Toolkit provides an AWS Java web project template for use in Eclipse. The template creates a web tools platform (WTP) dynamic web project that includes the AWS SDK for Java in the project's classpath. Your AWS account credentials and a simple index.jsp file are provided to help you get started. The following instructions assume you have installed both the Eclipse IDE for Java EE Developers and the AWS Toolkit plug-in. For more information, see Setting Up the AWS Toolkit for Eclipse.
Also check this & this
I would recommend 1st approach using Beanstalk to deploy your jsp application. There you are going to leverage all the advantages of AWS like load balancing, auto scaling, ddb and DW support and many other technologies. With Beanstalk you setup dev environment on your local machine and deploy the changes in AWS and once setup is done you are done...
May be you will need to spend some time on migrating from MySQL but that will be work on longer duration when you are going to have lot of users.

Logging Google App Engine application

I have made my GAE application using the development server, but now when I deploy it to GAE cloud, some features don't work (some elements are missing), but no exceptions are thrown.
Now I'd like to have some logging to my code so I could find out why these things are working in development environment, but not in GAE cloud, but I haven't found a way to log events like I can do with the development server in Eclipse.
So is it possible to log events like you can do in the Eclipse development server?
Google App Engine applications written in Java can write information to the log files using java.util.logging.Logger. Log data for an application can be viewed and analyzed using the Administration Console, or downloaded using appcfg.sh request_logs.
More info in the Logging documentation.
You will have to configure logging via java.util.logging.Logger and a logging.properties file in your classpath, preferably in your WEB-INF/classes/ directory. e.g. if you want all your logging to be at the INFO level, the contents of this file should be:
# Set the default logging level for all loggers to INFO
.level = INFO
The article that was marked as correct answer is a little bit outdated.
Today if you have to read your logs or want remotely debug your app you can use
Google Stackdriver Logging (web)
Google Stackdriver Error Reporting (web)
Google Stackdriver Debug (web)
gcloud command-line interface to Google Cloud (console, just type gcloud app logs tail to see latests log from your deployed app)
Java GAE applications still write information to the log files using java.util.logging.Logger.
Again, if you want more information about the Google App Engine Java logging read the documentation.
I assume you are asking for the Log console to see the error info and such. if yes then open your Google app engine launcher and click on your app and you can see a Logs button on the top next to Run and Stop.
Good luck!

Categories