-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbunyan-es-template.js
162 lines (158 loc) · 5.17 KB
/
bunyan-es-template.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// The bunyan.js script outputs JSON documents for storing in Elasticsearch. These should be
// compatible with the following Elasticsearch template:
{
template: 'bunyan-*',
settings: {
'index.codec': 'best_compression',
// Configure the number of shards based on your ES data node count
'index.number_of_shards': 2,
analysis: {
tokenizer: {
autocomplete_filter: {
type: "edge_ngram",
min_gram: 1,
max_gram: 20,
token_chars: ["letter", "digit", "punctuation"]
},
code_keyword_tokenizer: {
type: 'pattern',
// Identifies stretches of non-keywords and numbers
pattern: '(?:[^a-zA-Z0-9_]++[0-9]*+)++',
},
},
analyzer: {
lowercase: {
tokenizer: 'keyword',
filter: 'lowercase',
},
autocomplete: {
type: "custom",
tokenizer: "autocomplete_filter",
filter: ['lowercase'],
},
code_keyword: {
type: 'custom',
tokenizer: 'code_keyword_tokenizer',
filter: ['lowercase'],
},
},
}
},
mappings: {
"bunyan": {
include_in_all: false,
dynamic: false,
properties: {
log: {
properties: {
recordFinder: {
type: 'keyword',
},
receivingPort: {
type: 'integer',
},
reportingIp: {
type: 'ip',
},
receivedTime: {
format: 'dateOptionalTime',
type: 'date'
},
eventTime: {
format: 'dateOptionalTime',
type: 'date',
},
tag: {
type: 'keyword',
},
message: {
type: 'text',
},
ipProtocol: { type: 'byte' },
all: {
properties: {
// Copies of all values set elsewhere
ip: { type: 'ip' },
hostname: { type: 'keyword' },
fqdn: { type: 'keyword' },
fqdnBreakdown: { type: 'keyword' },
samName: { type: 'keyword' }, // Always uppercase
serviceName: { type: 'keyword' },
sid: { type: 'keyword' }, // Always uppercase
port: { type: 'integer' },
domain: { type: 'keyword' }, // Always uppercase
upn: { type: 'keyword' }, //
logonId: { type: 'keyword' }, // 0xHEX
}
},
source: {
properties: {
ip: { type: 'ip', copy_to: 'log.all.ip' },
hostname: { type: 'keyword', copy_to: 'log.all.hostname' },
fqdn: { type: 'keyword', copy_to: 'log.all.fqdn' },
fqdnBreakdown: { type: 'keyword', copy_to: 'log.all.fqdnBreakdown' },
samName: { type: 'keyword', copy_to: 'log.all.samName' }, // Always uppercase
serviceName: { type: 'keyword', copy_to: 'log.all.serviceName' },
sid: { type: 'keyword', copy_to: 'log.all.sid' }, // Always uppercase
port: { type: 'integer', copy_to: 'log.all.port' },
domain: { type: 'keyword', copy_to: 'log.all.domain' }, // Always uppercase
upn: { type: 'keyword', copy_to: 'log.all.upn' }, //
logonId: { type: 'keyword', copy_to: 'log.all.logonId' }, // 0xHEX
}
},
target: {
properties: {
ip: { type: 'ip', copy_to: 'log.all.ip' },
hostname: { type: 'keyword', copy_to: 'log.all.hostname' },
fqdn: { type: 'keyword', copy_to: 'log.all.fqdn' },
fqdnBreakdown: { type: 'keyword', copy_to: 'log.all.fqdnBreakdown' },
samName: { type: 'keyword', copy_to: 'log.all.samName' }, // Always uppercase
serviceName: { type: 'keyword', copy_to: 'log.all.serviceName' },
sid: { type: 'keyword', copy_to: 'log.all.sid' }, // Always uppercase
port: { type: 'integer', copy_to: 'log.all.port' },
domain: { type: 'keyword', copy_to: 'log.all.domain' }, // Always uppercase
upn: { type: 'keyword', copy_to: 'log.all.upn' }, //
logonId: { type: 'keyword', copy_to: 'log.all.logonId' }, // 0xHEX
}
},
}
},
bunyan: {
properties: {
pid: {
type: 'integer',
},
module: {
type: 'keyword',
},
level: {
type: 'byte',
},
interest: {
type: 'byte',
},
msg: {
type: 'text',
},
err: {
properties: {
name: {
type: 'keyword',
},
message: {
type: 'text',
},
stack: {
type: 'text',
}
}
},
}
}
}
}
},
aliases: {
'bunyan': {}
}
}