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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
ruby_block "check_ElasticSearch_Cluster_Health" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
resp = Net::HTTP.get_response URI.parse(curl_command)
stat = JSON.parse(resp.read_body)['status']
case stat
when "green"
printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.")
when "yellow"
printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...")
when "red"
printf("\033[31m%s\n\033[0m", " ElasticSearch Cluster status is red!")
break;
end
end
retries 50
retry_delay 2
end
bash "create audit mapping" do
code <<-EOH
curl -i -X PUT -d '{ "order": 1, "template": "auditingevents-*", "settings": {}, "mappings":
{
"distributiondownloadevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"RESOURCE_URL": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }
},
"_all": { "enabled": true }
},
"auditinggetuebclusterevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }
},
"_all": { "enabled": true }
},
"distributionstatusevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"RESOURCE_URL": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TOPIC_NAME":{ "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }
},
"_all": { "enabled": true }
},
"distributionengineevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TOPIC_NAME":{ "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ROLE": { "include_in_all": true, "type": "string" },
"API_KEY": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"D_ENV": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }
},
"_all": { "enabled": true }
},
"useraccessevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"USER": { "include_in_all": true, "type": "string" }
},
"_all": { "enabled": true }
},
"resourceadminevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"INVARIANT_UUID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CURR_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CURR_STATE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" },
"PREV_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"PREV_STATE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"RESOURCE_NAME": { "include_in_all": true, "type": "string" },
"RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DPREV_STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DCURR_STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TOSCA_NODE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"COMMENT": { "include_in_all": true, "type": "string" },
"ARTIFACT_DATA": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"PREV_ARTIFACT_UUID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CURR_ARTIFACT_UUID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }
},
"_all": { "enabled": true }
},
"useradminevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"USER_AFTER": { "include_in_all": true, "type": "string" },
"USER_BEFORE": { "include_in_all": true, "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" }
},
"_all": { "enabled": true }
},
"distributionnotificationevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CURR_STATE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CURR_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" },
"RESOURCE_NAME": { "include_in_all": true, "type": "string" },
"RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TOPIC_NAME":{ "include_in_all": true, "index": "not_analyzed", "type": "string" }
},
"_all": { "enabled": true }
},
"categoryevent": {
"properties": {
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CATEGORY_NAME": { "include_in_all": true, "type": "string" },
"SUB_CATEGORY_NAME": { "include_in_all": true, "type": "string" },
"GROUPING_NAME": { "include_in_all": true, "type": "string" },
"RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }
},
"_all": { "enabled": true }
},
"authevent": {
"properties": {
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" },
"DESC": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"URL": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"USER": { "include_in_all": true, "type": "string" },
"AUTH_STATUS": { "include_in_all": true, "index": "not_analyzed","type": "string" } ,
"REALM": { "include_in_all": true, "index": "not_analyzed","type": "string" }
},
"_all": { "enabled": true }
},
"consumerevent": {
"properties": {
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"ECOMP_USER": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }
},
"_all": { "enabled": true }
},
"getuserslistevent": {
"properties": {
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DETAILS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }
},
"_all": { "enabled": true }
},
"getcategoryhierarchyevent": {
"properties": {
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DETAILS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }
},
"_all": { "enabled": true }
},
"distributiondeployevent": {
"properties": {
"ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"CURR_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"DESC": { "include_in_all": true, "type": "string" },
"DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"MODIFIER": { "include_in_all": true, "type": "string" },
"REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"RESOURCE_NAME": { "include_in_all": true, "type": "string" },
"RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
"TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }
},
"_all": { "enabled": true } }
},
"aliases": { "last_3_months": {}}}' http://#{node['Nodes']['ES']}:9200/_template/audit_template
EOH
end
bash "set default index for Kibana" do
code <<-EOH
curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}'
curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}'
EOH
end
|