# Logging Plugin for Microgateway

**URL:** <https://discuss.google.dev/t/logging-plugin-for-microgateway/4972>\
**Category:** Apigee\
**Tags:** api-runtime\
**Created:** [June 27, 2018, 11:48am UTC](https://discuss.google.dev/t/logging-plugin-for-microgateway/4972 "2018-06-27T11:48:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [June 27, 2018, 11:48am UTC](https://discuss.google.dev/t/logging-plugin-for-microgateway/4972/1 "2018-06-27T11:48:28Z")

</div>

I want to configure Bunyan logging plugin for micro gateway. Could you please help me with the steps to integrate it. I followed the steps in the below link but I am not able to see the logs in the path specified apart from the default logs.

[https://apigee.com/about/blog/api-technology/tutorial-adding-logger-plugin-apigee-edge-microgateway](https://apigee.com/about/blog/api-technology/tutorial-adding-logger-plugin-apigee-edge-microgateway)

Could you please help me with the complete reference for integrating the Bunyan logging plugin.

Thank you.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [June 27, 2018, 3:03pm UTC](https://discuss.google.dev/t/logging-plugin-for-microgateway/4972/2 "2018-06-27T15:03:14Z")

</div>

Take a look at slide 37 here: [https://www.slideshare.net/apigee/apigee-edge-intro-to-microgateway](https://www.slideshare.net/apigee/apigee-edge-intro-to-microgateway)

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [July 9, 2018, 2:13pm UTC](https://discuss.google.dev/t/logging-plugin-for-microgateway/4972/3 "2018-07-09T14:13:34Z")

</div>

@[srinandans](https://community.apigee.com/users/9305/srinandans.html)

I have referred the above link as well and even it contains the same info what I have mentioned in the above link.

@[Dino-at-Google](https://community.apigee.com/users/8595/dchiesa-1.html) could you please help me with this requirement.

We are planning to log parallel call logs to Splunk server using this plugin. could you please help me with this.

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [March 9, 2020, 6:44am UTC](https://discuss.google.dev/t/logging-plugin-for-microgateway/4972/4 "2020-03-09T06:44:23Z")

</div>

//Write Custom Plugin using the “Bunyan”

var bunyan = require(“bunyan”);

var splunkBunyan = require(“splunk-bunyan-logger”);

var config = { token: “your-token-here”, url: “[https://splunk.local](https://splunk.local/):8088” };

var splunkStream = splunkBunyan.createStream(config);

// Enable SSL certificate validation

stream.logger.requestOptions.strictSSL = true;

// Note: splunkStream must be set to an element in the streams array

module.exports.init = function() {

//use either bunyan OR splunkBunyan to createLogger()

var log = bunyan.createLogger(

{ name: “my logger”, streams: [

{ level: ‘error’, stream: splunkStream },

{ level: ‘debug’, stream: process.stderr, },

{ level: ‘info’, type: ‘rotating-file’, path: ‘/var/log/foo.log’, period: ‘1d’ , count: 3 }

]

});

return { onrequest: function(req, res, next)

{

[log.info](http://log.info/)(‘ONREQUEST’); next();

}, onend\_request: function(req, res, data, next) { [log.info](http://log.info/)(“ONEND\_REQUEST”); next(null, data);

}

};

}

//referrer

// [https://npm.taobao.org/package/splunk-bunyan-logger](https://npm.taobao.org/package/splunk-bunyan-logger)

// [https://www.npmjs.com/package/bunyan#streams](https://www.npmjs.com/package/bunyan#streams)

//Installation

//npm install --save splunk-bunyan-logger

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [May 5, 2020, 8:36pm UTC](https://discuss.google.dev/t/logging-plugin-for-microgateway/4972/5 "2020-05-05T20:36:01Z")

</div>

Is there a way to force this plugin, like analytics plugin? We are using oauth and in case of error it skips logger plugin/any plugin that comes next.
