0

I'm trying to filter my log, based on a string contained in log message. I found some hints to use conditional logging (https://www.nginx.com/blog/sampling-requests-with-nginx-conditional-logging/), but i couldn't find any hints for my use case. Is this even possible?

JD2k
  • 48
  • 1
  • 7
  • In any case nginx access log entry composed of various nginx variables (both internal and user-defined). Saying "based on a string contained in the message" do you mean that you want to log this line no matter what variable contains that string? Otherwise you can simply check the corresponding variable. Please add some details/clarity to your question. – Ivan Shatsky Nov 10 '21 at 10:59
  • I have a working nodejs app via passenger running. Every console.log() in this app is logged in nginx error.log via phusion log. In these lines i added the appname, like: "appname | ". Now i want to get those messages into another error.log file. I thought conditional filtering would be the right way, but i didn't find the message variable for regex filtering ("appname |"). – JD2k Nov 10 '21 at 12:56

1 Answers1

0

I come to the conclusion that this is not possible, because nginx doesn't even "know" about log messages (console.log...) from passenger. Passenger is just using the same error.log file nginx is using.

JD2k
  • 48
  • 1
  • 7