Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plasne/oms-query
Node.js sample showing how to query OMS.
https://github.com/plasne/oms-query
azure nodejs oms
Last synced: 7 days ago
JSON representation
Node.js sample showing how to query OMS.
- Host: GitHub
- URL: https://github.com/plasne/oms-query
- Owner: plasne
- Created: 2017-04-17T13:20:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:37:26.000Z (about 2 years ago)
- Last Synced: 2024-11-12T12:40:43.997Z (2 months ago)
- Topics: azure, nodejs, oms
- Language: JavaScript
- Size: 59.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OMS Query
This sample shows how to query the Log Analytics component of Operational Management Suite.
## Configuration
* Create a Log Analytics resource in Azure and point it to your OMS instance (or create a new OMS instance).
* Create a Azure AD Web App and grant it READER rights on the subscription, the Resource Group, or Log Analystics resource.
* Rename the config/sample.default.json to config/default.json.
* Put all the connectivity information into the config/default.json file.To use the ARM API:
* You will need to follow the additional steps detailed here: https://dev.loganalytics.io/documentation/1-Tutorials/ARM-API
* Reading Log Analytics data using the application permissions says it requires administrative consent (that wasn't true in my testing), but you might need to run the consent instructions below.## Query
There are 3 different query endpoints you can call...
```bash
node oms --api legacy query
node oms --api direct query
node oms --api arm query
```Optionally, you can supply parameters to override the Resource Group, Workspace, and Workpace ID in the configuration file.
```text
Usage: oms [options] [command]Options:
-V, --version output the version number
--api Specify the API to use between: legacy, direct, azure.
--docs Show all documentation links.
-r, --resource-group Specify a Resource Group other than the one in the settings file.
-w, --workspace Specify a Workspace Name other than the one in the settings file.
-i, --workspace-id Specify a Workspace ID other than the one in the settings file.
-h, --help output usage informationCommands:
docs Show all documentation links.
consent Get the consent URL for the new API.
info Get the info regarding the workspace.
query Query OMS.
```## Info
You can run the command like this...
```bash
node oms info
```...to get the information about the workspace in the file or...
```bash
node oms --workspace myworkspace info
```...to get information about a specified workspace.
One reason to get the workspace information is to find out what version of the query system you are using. The version can be found under "properties/features/searchVersion".
* 0 is the legacy query syntax
* 1 is the new query syntax## Consent
To apply administrative consent (which didn't actually appear to be required despite the notification), you can run...
```bash
node oms consent
```You can then use an administrative account to go through administrative consent to approve the application.