# azure-loganalytics

> LogAnalyticsClient Library with typescript type definitions for node

Latest version **0.2.0** (published 2018-11-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install azure-loganalytics
pnpm add azure-loganalytics
yarn add azure-loganalytics
bun add azure-loganalytics
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2018-11-07 |
| First published | 2018-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 38.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1174 |
| Author | Microsoft Corporation |
| Maintainers | windowsazure |
| Keywords | node, azure |

## Links

- npm: https://www.npmjs.com/package/azure-loganalytics
- Repository: https://github.com/azure/azure-sdk-for-node
- Homepage: https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/loganalytics
- Issues: https://github.com/azure/azure-sdk-for-node/issues
- npm.io page: https://npm.io/package/azure-loganalytics

## Dependencies (1)

- [ms-rest](https://npm.io/package/ms-rest.md) ^2.3.3

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2018-11-07
- 0.1.1 — 2018-08-22
- 0.1.0 — 2018-06-14

## README

---
uid: azure-loganalytics
summary: *content

---
# Microsoft Azure SDK for Node.js - LogAnalyticsClient
This project provides a Node.js package for accessing Azure Log Analytics query services.
- **Node.js version 6.x.x or higher**

## How to Install

```bash
npm install azure-loganalytics
```

## How to use

### Authentication, client creation and query execution example.

```javascript
const msrestazure = require('ms-rest-azure');
const LogAnalyticsClient = require('azure-loganalytics');

var options = {
  tokenAudience: 'https://api.loganalytics.io'
}

msrestazure.loginWithServicePrincipalSecret(
  'clientId or appId',
  'secret or password',
  'AAD domain or tenantId',
  options,
  (err, credentials) => {
    if (err) throw err
    // ..use the client instance to access service resources.
    const client = new LogAnalyticsClient(creds);

    const workspaceId = 'ed6078ff-9048-4dd7-9b21-fc39e3fc7249';
    var body = {
      query: 'Heartbeat | getschema',
      timespan: 'P2D'
    };

    client.query(workspaceId, body).then((result) => {
      console.log('The result is:');
      console.log('Columns:')
      console.table(result.tables[0].columns)
      console.log('Rows:')
      console.table(result.tables[0].rows);
    }).catch((err) => {
      console.log('An error occurred:');
      console.dir(err, {depth: null, colors: true});
    });

    // Join additional workspaces in the body
    body = {
      query: 'AzureActivity | getschema',
      workspaces: ['f30c1f56-e33c-418e-b515-9212fa3b7904']
    };

    client.query(workspaceId, body).then((result) => {
      console.log('The result is:');
      console.log('Columns:')
      console.table(result.tables[0].columns)
      console.log('Rows:')
      console.table(result.tables[0].rows);
    }).catch((err) => {
      console.log('An error occurred:');
      console.dir(err, {depth: null, colors: true});
    });
  }
);
```
## Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)

---
_Source: https://npm.io/package/azure-loganalytics · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
