question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support option for ignoring paths

See original GitHub issue

Our hapi servers export a /healthz it would be nice if we could omit those requests from the logs.

Would you be open to a PR for this functionality?

I know another option would be to pipe to a filter but I wanted to see the appetite for this built in.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
tiagoalvescommented, Feb 20, 2018

I need to silence our /healthz polling logs as well and tried to use the new ignorePaths feature in PR #30. However, it’s not flexible enough for my use case since it matches the routes against request.url.path which includes the request’s query params but my query params can have dynamic values.

Just in case it helps someone in the future, I ended up silencing our logs with this micro hapi plugin:

/**
 * A minimal plugin that silences the `hapi-pino`
 * response log for the `/healthz` route.
 */
exports.plugin = {
  register: async (server, options) => {
    server.ext('onPreResponse', (request, h) => {
      if (request.url.pathname === '/healthz') {
        request.logger.level = 'silent'
      }
      return h.continue
    })
  },
  name: 'health-log-silencer',
  version: '1.0.0'
}
0reactions
muuhoffmancommented, Jan 29, 2021

I was still struggling with this and this worked well for me in the pino-http or express-pino-logger (which just uses pino-http) library:

const expressLogger = expressPino({
  autoLogging: {
    ignorePaths: ["/_next"],
    getPath: (req) => {
      if (/_next/.test(req.url)) {
        return "/_next"
      }
      return req.url
    }
  },
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring Paths - Codecov
You can use the top-level ignore: key to tell Codecov to ignore certain paths. Add a list of paths (folders or file names)...
Read more >
Ignores - Mutagen
This isn't always desirable, so Mutagen supports ignoring paths within a synchronization root and excluding them from synchronization.
Read more >
/X (Ignore standard include paths) | Microsoft Learn
Prevents the compiler from searching for include files in directories specified in the PATH and INCLUDE environment variables. Syntax. /X ...
Read more >
[NODE] agent not respecting rule to ignore path
One option is to utilize the rules checker built into the agent. With this you can you can set the endpoint to ignore...
Read more >
Ignoring Unc Paths - BarTender Support Portal
It's as though BarTender Commander just doesn't like UNC paths and actively ... command line options prints the document seemingly fine:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found