Can I store a specific query in access_log file by filtering with an expression? For example I want to deny storing queries related to www.mydomaine.com and then reject it ?

Best regards,


closed as unclear what you're asking by womble Aug 11 '16 at 1:30

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    rephrase your question – alexus Aug 10 '16 at 15:14

You can set access_log off; inside a location. It will override the access_log setting at a higher level, and stop logging for any requests that match that location.

  • Hello, I'm newer in nginx. Have you a specefic example ? – N.Khalifa Aug 11 '16 at 9:51
  • For example, i want nginx to write requests on access.log only that dont contain "mysting" – N.Khalifa Aug 11 '16 at 9:55
  • Like this ? server{ access_log off; location { if ($request != myString)access_log on; }} – N.Khalifa Aug 11 '16 at 9:57
  • @N.Khalifa That's valid syntax, but it would log to a file named "on", which is probably not what you want to name your access log. – Michael Hampton Aug 11 '16 at 15:41
  • Thak you :) In my example i invert it to server{ access_log on; location { if ($request != myString)access_log off; }} – N.Khalifa Aug 12 '16 at 7:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.