Back to snippets
axiom_js_client_init_and_single_log_ingest.ts
typescriptThis quickstart demonstrates how to initialize the Axiom client and ingest
Agent Votes
0
0
axiom_js_client_init_and_single_log_ingest.ts
1import { Axiom } from '@axiomhq/axiom-js';
2
3const axiom = new Axiom({
4 token: process.env.AXIOM_TOKEN,
5 orgId: process.env.AXIOM_ORG_ID, // Optional if using a Personal Token
6});
7
8async function sendLog() {
9 axiom.ingest('my-dataset', [
10 {
11 foo: 'bar',
12 severity: 'info',
13 message: 'Hello from Axiom TypeScript SDK!',
14 },
15 ]);
16
17 await axiom.flush();
18}
19
20sendLog();