slanatech / swagger-stats

API Observability. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices.
https://swaggerstats.io/
MIT License
893 stars 137 forks source link

how to change elasticsearch index default is api-* i want to change #45

Closed dduo518 closed 6 years ago

sv2 commented 6 years ago

new option elasticsearchIndexPrefix is added. Use this option to specify desired index prefix, for example:

        // Enable swagger-stats middleware
        app.use(swStats.getMiddleware({
            name: 'swagger-stats-testapp',
            version: '0.95.6',
            timelineBucketDuration: tlBucket,
            uriPath: '/swagger-stats',
            swaggerSpec:swaggerSpec,
            elasticsearch:'http://127.0.0.1:9200',
            elasticsearchIndexPrefix:'swagger-stats-',
            onResponseFinish: function(req,res,rrr){
                debug('onResponseFinish: %s', JSON.stringify(rrr));
            }
        }));