{"action":"created","issue":{"url":"https://api.github.com/repos/slanatech/swagger-stats/issues/47","repository_url":"https://api.github.com/repos/slanatech/swagger-stats","labels_url":"https://api.github.com/repos/slanatech/swagger-stats/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/slanatech/swagger-stats/issues/47/comments","events_url":"https://api.github.com/repos/slanatech/swagger-stats/issues/47/events","html_url":"https://github.com/slanatech/swagger-stats/issues/47","id":348967790,"node_id":"MDU6SXNzdWUzNDg5Njc3OTA=","number":47,"title":"change elk index ","user":{"login":"chong0808","id":16454649,"node_id":"MDQ6VXNlcjE2NDU0NjQ5","avatar_url":"https://avatars2.githubusercontent.com/u/16454649?v=4","gravatar_id":"","url":"https://api.github.com/users/chong0808","html_url":"https://github.com/chong0808","followers_url":"https://api.github.com/users/chong0808/followers","following_url":"https://api.github.com/users/chong0808/following{/other_user}","gists_url":"https://api.github.com/users/chong0808/gists{/gist_id}","starred_url":"https://api.github.com/users/chong0808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chong0808/subscriptions","organizations_url":"https://api.github.com/users/chong0808/orgs","repos_url":"https://api.github.com/users/chong0808/repos","events_url":"https://api.github.com/users/chong0808/events{/privacy}","received_events_url":"https://api.github.com/users/chong0808/received_events","type":"User","site_admin":false},"labels":[{"id":548650276,"node_id":"MDU6TGFiZWw1NDg2NTAyNzY=","url":"https://api.github.com/repos/slanatech/swagger-stats/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"sv2","id":2171896,"node_id":"MDQ6VXNlcjIxNzE4OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/2171896?v=4","gravatar_id":"","url":"https://api.github.com/users/sv2","html_url":"https://github.com/sv2","followers_url":"https://api.github.com/users/sv2/followers","following_url":"https://api.github.com/users/sv2/following{/other_user}","gists_url":"https://api.github.com/users/sv2/gists{/gist_id}","starred_url":"https://api.github.com/users/sv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sv2/subscriptions","organizations_url":"https://api.github.com/users/sv2/orgs","repos_url":"https://api.github.com/users/sv2/repos","events_url":"https://api.github.com/users/sv2/events{/privacy}","received_events_url":"https://api.github.com/users/sv2/received_events","type":"User","site_admin":false},"assignees":[{"login":"sv2","id":2171896,"node_id":"MDQ6VXNlcjIxNzE4OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/2171896?v=4","gravatar_id":"","url":"https://api.github.com/users/sv2","html_url":"https://github.com/sv2","followers_url":"https://api.github.com/users/sv2/followers","following_url":"https://api.github.com/users/sv2/following{/other_user}","gists_url":"https://api.github.com/users/sv2/gists{/gist_id}","starred_url":"https://api.github.com/users/sv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sv2/subscriptions","organizations_url":"https://api.github.com/users/sv2/orgs","repos_url":"https://api.github.com/users/sv2/repos","events_url":"https://api.github.com/users/sv2/events{/privacy}","received_events_url":"https://api.github.com/users/sv2/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-08-09T03:50:31Z","updated_at":"2018-09-01T17:45:32Z","closed_at":null,"author_association":"NONE","body":"I want to use different index!\r\nwell! \r\nif change the \r\nhttps://github.com/slanatech/swagger-stats/blob/1a61c6cd31ced912a6ea4c0db53f16c626e40137/schema/elasticsearch/api_index_template.json#L2 \r\nchange to \r\n```\r\n \"template\": \"server-1-*\",\r\n```\r\nok? \r\n\r\nor \r\n```\r\n\r\napp.use(swStats.getMiddleware({\r\n    elasticsearch: \"http://10.40.2.89:9200\",\r\n    elasticsearchIndex: \"server-1-*\"  // Configuration els index\r\n}));\r\n\r\n```\r\nhttps://github.com/slanatech/swagger-stats/blob/1a61c6cd31ced912a6ea4c0db53f16c626e40137/lib/swsUtil.js#L11\r\n```\r\n// swagger-stats supported options\r\nmodule.exports.supportedOptions = {\r\n\r\n    // ....\r\n    // ElasticSearch URL. Enables storing of request response records in Elasticsearch.\r\n    // Default is empty (disabled).\r\n    elasticsearch: \"elasticsearch\",\r\n    elasticsearchIndex: \"api-*\", // elk default index\r\n\r\n   //...\r\n\r\n};\r\n```\r\nhttps://github.com/slanatech/swagger-stats/blob/1a61c6cd31ced912a6ea4c0db53f16c626e40137/lib/swsElasticEmitter.js#L42\r\n```\r\n// Initialize\r\nswsElasticEmitter.prototype.initialize = function(swsOptions) {\r\n\r\n    if (typeof swsOptions === 'undefined') return;\r\n    if (!swsOptions) return;\r\n\r\n    this.options = swsOptions;\r\n\r\n    // Set or detect hostname\r\n    if (!(swsUtil.supportedOptions.elasticsearch in swsOptions)) {\r\n        debug('Elasticsearch is disabled');\r\n        return;\r\n    }\r\n    if (this.options.elasticsearchIndex) {\r\n        indexTemplate.template = this.options.elasticsearchIndex\r\n    }\r\n\r\n   //......\r\n\r\n};\r\n```\r\n\r\nhttps://github.com/slanatech/swagger-stats/blob/1a61c6cd31ced912a6ea4c0db53f16c626e40137/lib/swsElasticEmitter.js#L144\r\n````\r\n// Index Request Response Record\r\nswsElasticEmitter.prototype.processRecord = function(rrr) {\r\n\r\n    //...\r\n    // Create metadata\r\n    var indexName = this.options.elasticsearchIndex + moment(rrr['@timestamp']).utc().format('YYYY.MM.DD');\r\n    var meta = { index: { _index: indexName, _type: this.options.elasticsearchIndex, _id: rrr.id } };\r\n    // console.log(indexTemplate)\r\n    // Add to buffer\r\n    // .....\r\n};\r\n````\r\n\r\nit is ok?  "},"comment":{"url":"https://api.github.com/repos/slanatech/swagger-stats/issues/comments/417875975","html_url":"https://github.com/slanatech/swagger-stats/issues/47#issuecomment-417875975","issue_url":"https://api.github.com/repos/slanatech/swagger-stats/issues/47","id":417875975,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzg3NTk3NQ==","user":{"login":"sv2","id":2171896,"node_id":"MDQ6VXNlcjIxNzE4OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/2171896?v=4","gravatar_id":"","url":"https://api.github.com/users/sv2","html_url":"https://github.com/sv2","followers_url":"https://api.github.com/users/sv2/followers","following_url":"https://api.github.com/users/sv2/following{/other_user}","gists_url":"https://api.github.com/users/sv2/gists{/gist_id}","starred_url":"https://api.github.com/users/sv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sv2/subscriptions","organizations_url":"https://api.github.com/users/sv2/orgs","repos_url":"https://api.github.com/users/sv2/repos","events_url":"https://api.github.com/users/sv2/events{/privacy}","received_events_url":"https://api.github.com/users/sv2/received_events","type":"User","site_admin":false},"created_at":"2018-09-01T17:45:32Z","updated_at":"2018-09-01T17:45:32Z","author_association":"COLLABORATOR","body":"new option `elasticsearchIndexPrefix` is added. Use this option to specify desired index prefix, for example:\r\n```\r\n        // Enable swagger-stats middleware\r\n        app.use(swStats.getMiddleware({\r\n            name: 'swagger-stats-testapp',\r\n            version: '0.95.6',\r\n            timelineBucketDuration: tlBucket,\r\n            uriPath: '/swagger-stats',\r\n            swaggerSpec:swaggerSpec,\r\n            elasticsearch:'http://127.0.0.1:9200',\r\n            elasticsearchIndexPrefix:'swagger-stats-',\r\n            onResponseFinish: function(req,res,rrr){\r\n                debug('onResponseFinish: %s', JSON.stringify(rrr));\r\n            }\r\n        }));\r\n```"}}
{"actor":{"display_login":"sv2"}}