forked from pinojs/pino-elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.d.ts
56 lines (43 loc) · 1.69 KB
/
lib.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type { Transform } from 'stream'
import type { ClientOptions } from '@elastic/elasticsearch'
export default pinoElasticsearch
declare function pinoElasticsearch(options?: Options): DestinationStream
export type DestinationStream = Transform & {
/**
* when something, that cannot be parsed, is encountered
*/
on(event: 'unknown', handler: (line: string, error: string) => void): void
/**
* when a bulk insert request failed which resulted in logs being dropped
*/
on(event: 'insertError', handler: (error: Error & { document: Record<string, any> }) => void): void
/**
* when a batch of logs was sent successfully
*/
on(event: 'insert', handler: (stats: Record<string, any>) => void): void
/**
* when some other kind of error happened, e.g. connection issues
*/
on(event: 'error', handler: (error: Error) => void): void
}
export type Options = Pick<ClientOptions, 'node' | 'auth' | 'cloud' | 'caFingerprint' | 'Connection' | 'ConnectionPool'> & {
index?: Index
type?: string
/** @deprecated use `opType` instead */
op_type?: OpType;
opType?: OpType;
/** @deprecated use `flushBytes` instead */
'flush-bytes'?: number | undefined
flushBytes?: number | undefined
/** @deprecated use `flushInterval` instead */
'flush-interval'?: number | undefined
flushInterval?: number | undefined
/** @deprecated use `esVersion` instead */
'es-version'?: number | undefined
esVersion?: number | undefined
/** @deprecated use `tls.rejectUnauthorized` instead */
rejectUnauthorized?: boolean
tls?: ClientOptions['tls'];
}
export type Index = string | `${string | ''}%{DATE}${string | ''}` | ((logTime: string) => string)
export type OpType = 'create' | 'index'