Giter Club home page Giter Club logo

azure-loganalytics-api's Introduction

What is it?

A simple API over Azure Log Analytics. The idea is, you can run this as a Docker container anywhere with some basic configuration, and consume log analytics queries via this API.

This is implemented for a very specific reason that fits a very specific setup. You might consider using Log Analytics APIs directly for less specific scenarios.

How to build

The solution uses a docker container to build the solution. Execute this command in the root to build the solution

docker build -t repo/name .

How to run the container?

You need following variables to deliver during the container startup:

  • SharedAccessSignature - An API Key that you can define on your own. You send this in the header of the call
  • TenantId - The Azure AD tenant ID - GUID
  • ClientID - A service principal ID that has RBAC access to OMS workspace
  • ClientSecret - The service principal Secret
  • LogAnalyticsWorkspaceID - The OMS workspace ID - GUID (Get it from Azure Portal)
  • LogAnalyticsPrimaryKey - The OMS workspace Primary Key (Get it from Azure Portal)

Once you have these secrets:

docker run -d -p 80:80 -e "SharedAccessSignature=<VALUE>" -e "TenantId=<KEY>" -e "ClientID=<KEY>" 
-e "ClientSecret=<KEY>" -e "LogAnalyticsWorkspaceID=<KEY>" -e  "LogAnalyticsPrimaryKey=<KEY>" repository/namecontainer:latest

How to post data to Log Analytics

Start the container and then execute a POST request to the following url

POST https://url/api/logs
Content-type:application/json
x-api-key: <SharedAccessSignature>

BODY
{
	"customlogType":"Name of the Custom Log Type e.g.",
	"json":{
		"demo":"demo"
	}
}

How to query Log Analytics

Start the container and then execute a GET request to the following url

POST https://url/api/logs?query=AzureDiagnostics
Content-type:application/json
x-api-key: <SharedAccessSignature>

Thanks

Forked from https://github.com/MoimHossain/azure-loganalytics-api

azure-loganalytics-api's People

Contributors

moimhossain avatar renevanosnabrugge avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.