loggly / loggly-jslogger

Client-side (browser) logger to use with Loggly v2
79 stars 51 forks source link

Disable logging when page is loaded by webcrawler #52

Closed kc1116 closed 6 years ago

kc1116 commented 6 years ago

Is there a way that I can disable my loggly logger whenever a webpage is loaded by a web crawler ? I have a Javascript Lib that logs using loggly. It is installed on some client sites, when their sites get loaded by a webcrawler some "errors" happen and force loggly to log a bunch of false positives. How can I handle this ?

mostlyjason commented 6 years ago

Have you considered only loading the Loggly logger when the user agent is not the web crawler? You'll have to look at the logs to see what the user agent of the web crawler is in order to exclude it. This is something you can do on your end and doesn't necessarily need to be in the library. Some people may want to know about errors when a crawler runs but if you don't you could add code to prevent this.

kc1116 commented 6 years ago

Thanks for the response, does loggly capture the userAgent by default or is that something I should send with events ?

mostlyjason commented 6 years ago

I don't think so, you should send it. We usually capture it with access logs, such as coming from a web, application or proxy server.