diff --git a/config.json b/config.json index 91bca89..03ac86f 100644 --- a/config.json +++ b/config.json @@ -2,7 +2,10 @@ "channeldeletetimeinminutes": 30, "deletecommandstoggle": false, "maxqueuesize": 4, - "elasticsearchhost": "http://jcreek.ddns.net:9200", + "elasticsearch" : { + "elasticsearch_address" : "http://jcreek.ddns.net:9200", + "elasticsearch_index_pattern" : "[logs-denbot-]YYYY.MM.DD" + }, "prefix": "!", "token": "NzcwMDQyMDEzMjY5NDkxNzUy.X5Xzgg.kcr_51g95iUvEcYCfbQvG1Sx8ao" } diff --git a/index.js b/index.js index 4e14dea..d8f8371 100644 --- a/index.js +++ b/index.js @@ -11,16 +11,17 @@ if (process.env.NODE_ENV === 'production') { const esTransportOpts = { level: 'error', + indexPrefix: 'logs_denbot', clientOpts: { - host: config.elasticsearchhost, + host: config.elasticsearch.elasticsearch_address, log: 'error' }, transformer: logData => { return { - "@timestamp": (new Date()).getTime(), + timestamp: new Date().toISOString(), severity: logData.level, - message: `${getCurrentDateAndTime()} - ${logData.message}`, - fields: { + message: logData.message, + meta: { app: 'denBot', env: env }