1.2.1 • Published 5 years ago
@splunkdlt/hec-client v1.2.1
@splunkdlt/hec-client
Flexible client library for Splunk HTTP Event Collector (HEC) with support for sending metrics and events, batching, compression, keep-alives and retries.
Install and Use
npm i @splunkdlt/hec-client
# or
yarn add @splunkdlt/hec-clientExample: sending some metrics to HEC:
const hec = new HecClient({
    url: 'https://http-inputs-acme.splunkcloud.com',
    token: '12345678-9999-4711-0815-C0FF33C0FFEE',
});
const mem = process.memoryUsage();
const cpu = process.cpuUsage();
hec.pushMetrics({
    time: Date.now(),
    measurements: {
        'myapp.cpu.user': cpu.user,
        'myapp.cpu.system': cpu.system,
        'myapp.mem.heapUsed': mem.heapUsed,
        'myapp.mem.heapTotal': mem.heapTotal,
    },
    fields: {
        hostname: os.hostname(),
    },
    metadata: {
        index: 'mymetrics',
        sourcetype: 'myapp:system',
        source: 'myapp',
    },
});
await hec.flush();1.2.1
5 years ago
1.2.0
5 years ago
1.1.0
5 years ago
1.0.0
5 years ago
0.1.0-alpha1.0
5 years ago
0.1.0-alpha1
5 years ago
0.1.0-alpha0
5 years ago