@ditjenpajakri/elasticsearch-logging 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apm.env +1 -1
- package/lib.js +9 -19
- package/package.json +1 -1
package/apm.env
CHANGED
package/lib.js
CHANGED
|
@@ -51,7 +51,7 @@ function initializeBulkHandler(opts, client, splitter) {
|
|
|
51
51
|
const esVersion = Number(opts.esVersion || opts["es-version"]) || 7;
|
|
52
52
|
const index = opts.index || "pino";
|
|
53
53
|
const buildIndexName = typeof index === "function" ? index : null;
|
|
54
|
-
// const type = esVersion >= 7 ? undefined : opts.type || "log";
|
|
54
|
+
// const type = esVersion >= 7 ? undefined : opts.type || "log";
|
|
55
55
|
const opType = esVersion >= 7 ? opts.opType || opts.op_type : undefined;
|
|
56
56
|
|
|
57
57
|
// Resurrect connection pool on destroy
|
|
@@ -210,28 +210,18 @@ if (require.main === module) {
|
|
|
210
210
|
|
|
211
211
|
const additionalFields = Object.keys(process.env).filter((key) =>
|
|
212
212
|
key.startsWith("LOG_ES_VAR_")
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
const additionalObject = additionalFields.reduce((obj, field) => {
|
|
216
|
-
const value = process.env[field.toLocaleUpperCase()];
|
|
217
|
-
function processKey(f, value) {
|
|
218
|
-
const parts = f ? f.split("_") : [];
|
|
219
|
-
if (parts.length) {
|
|
220
|
-
return processKey(parts.slice(0, parts.length - 1).join("_"), {
|
|
221
|
-
[parts[parts.length - 1]]: value,
|
|
222
|
-
});
|
|
223
|
-
} else {
|
|
224
|
-
if (f) return { [f]: value };
|
|
225
|
-
else return value;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
213
|
+
);
|
|
228
214
|
|
|
229
|
-
|
|
230
|
-
|
|
215
|
+
const additionalObject = {};
|
|
216
|
+
additionalFields.forEach((field) => {
|
|
217
|
+
const value = process.env[field];
|
|
218
|
+
const key = field.slice(11);
|
|
219
|
+
additionalObject[key] = value;
|
|
220
|
+
});
|
|
231
221
|
|
|
232
222
|
start({
|
|
233
223
|
node: process.env.LOG_ES_HOST || "http://localhost:9200",
|
|
234
|
-
additionalObject
|
|
224
|
+
additionalObject,
|
|
235
225
|
auth: {
|
|
236
226
|
username: process.env.LOG_ES_USER || "elastic",
|
|
237
227
|
password: process.env.LOG_ES_PASS || "changeme",
|