Python application logging with Azure Log Analytics - python

I have a small Python (Flask) application running in a Docker container.
The container orchestrator is Kubernetes, all running in Azure.
What is the best approach to set up centralized logging? (similar to Graylog)
Is it possible to get the application logs over OMS to Azure Log Analytics?
Thank you,
Tibor

I have a similar requirement. I have a continuously running Python application running in a Docker container. So far I have found that the Azure SDK for Python supports lots of integration into Azure from Python. This page might be able to help:
https://pypi.org/project/azure-storage-logging/
Here is also a package and guide how to set up Blob Storage and enable logging:
https://github.com/Azure/azure-storage-python/tree/master/azure-storage-blob

Related

How to host Azure Python API via Azure Data Storage

I have python scripts that I want to host as a web app in azure.
I want to keep the function scripts in azure data storage and host them as a python API in azure.
I want some devs to be able to change the scripts in the azure data storage and reflect the changes live without having to deploy.
How can I got about doing this?
Create Function App of Runtime Stack Python supported only in Linux Version in any Hosting Plan through Azure Portal.
Make the Continuous Deployment setting to GitHub under Deployment Center of the function app in the portal like below:
After authorizing, provide your GitHub Repository details in the same section.
Create the Azure Python Functions from VS Code and deploy to the GitHub Repository using Git Clone through Command Palette.
After that, you can deploy the functions to azure function app.
Here after publishing to azure, you'll get the Azure Functions Python Rest API.
I want some devs to be able to change the scripts in the azure data storage and reflect the changes live without having to deploy.
Whenever you or dev's make changes the changes in code through GitHub and commit the changes, then it automatically reflects in the Azure Portal Function App.
For more information, please refer this article and GitHub actions of editing the code/script files.

Implementing web service with python on a virtual AWS instance

I need to implement a simple web service in python - it's my first experience with web services and REST APIs so I want to undertand what environment and tools would fit my needs. In my web service, I need to read some data from a database, do some simple logic, and support a GET call from another application (qualtrics).
I read and implemented a simple test web service with python using some useful blogs such as: Building a Basic RestFul API in Python | Codementor
but I need a real server so that I could call the API from external applications.
As I'm looking for a long term solution, I thought that using AWS EC2 instance may be a good solution for a server. I tried to implement it using some guidelines in blogs such as: Deploy a Flask app on AWS EC2 | Codementor
However, as I'm new to this and encountered some implementation/editing errors (e.g. handling of the wsgi file) and as I'm a windows person and the ubuntu stuff are not always easy to get used to, I was wondering what is the best framework for my needs?
Is there any recomended flow in which I'll be able to implement my simple python code and connect it to a small server (either AWS EC2 instance or any other recomended one) in a more convenient way?
Another important note - I will need to run it only from time to time, this web server and web service should not be contantly live (that's why I thought that aws virtual instance would fit best).
To begin, my recommendation would be to look at Elastic Beanstalk, Fargate and API Gateway with Lambda.
You can use Elastic Beanstalk to easliy provision out-of-the-box AWS environment to host your python app in Flask with minimal configurations required:
Deploying a flask application to Elastic Beanstalk.
The other thing to consider would be to develop your python app as a docker container using, e.g., tiangolo/uwsgi-nginx-flask as the base image. This would allow you to easily work with in on your localhost, and then just move your image to AWS for hosting.
You can host it on Fargate to save time on configuring container instances, or on Beanstalk as well which also supports docker.
Yet other choice is to go fully serverless and develop your Python REST api using API Gateway and lambda.

Python libraries in Azure

I have a requirement where I have to use the Python libraries I created on my machine, in the cloud, such that whenever any new dataset is loaded, this Python library have to start acting on it.
How can I do this? Where will I put the dataset and the python codes in Azure?
Thanks,
Shyam
There are more possibility to do that.
Run your Python code on Azure Web Apps for Containers—a Linux-based, managed application platform
Azure Functions allows running Python code in a serverless environment that scales on-demand.
Use a managed Hadoop and Spark cluster with Azure HDInsights, suitable for enterprise-grade production workloads.
Use a friction-free data science environment that contains popular tools for data exploration, modeling, and development activities.
Azure Kubernetes Service (AKS) offers a fully-managed Kubernetes cluster to run your Python apps and services, as well as any other Docker container. Easily integrate with other Azure services using Open Service Broker for Azure.
Use your favorite Linux distribution, such as Ubuntu, CentOS, and Debian, or Windows Server. Run your code with scalable Azure Virtual Machines and Virtual Machine Scale Sets.
Run your own Python data science experiments using a fully-managed Jupyter notebook with Azure Notebooks.
The easiest and fastest way to run your code is 1. option. Create a web app and a web job in there.

How to deploy and use custom python package on azure as a service and consume it

I have created a custom python package which has few machine learning algorithms in it.
I would like to deploy this custom python package on azure as a service that can be consume by my other applications like a batch job and a website.
I have bought an azure license but have no clue on the deployment strategy. Please advice
I'd recommend using the following documentation, it will allow you to Deploy Python application to Azure App Service using VSTS.The lab would provide you with the same skills to deploy your app to Azure App service.

Running scripts on cloud

I'm new to cloud computing domain. Here is what I've:
1) A domain.
2) A hosting space (on HostGator).
3) A Microsoft Azure account.
And here is what I need to do:
1) Take an input file from the user using HTML.
2) Processing the input file using a Python script.
3) Returning an output file generated by the script to the user.
How do I do this? Any rough steps?
I want to implement this using Microsoft Azure.
Though HostGator supposedly supports Python 2.7, I couldn't run my scripts there and got an Internal Server Error 500.
As Azure is a cloud platform which provides a growing collection of integrated services.You can leverage Azure Web Apps to approach your need.
You can build your python project on local first, then create a Web app on Azure portal, and deploy your project to Azure Web app with Git, FTP or Visual Studio.
Here is an official reference about how to deploy python project on Azure Web app step by step.
Also, you can configure a custom domain name in Azure Web Apps, for more information you can find in Configure a custom domain name in Azure App Service

Categories