39

I'd like to log the same access.log entries to separate files, so when a request comes in it should populate a.log and b.log. Is there any way to do this with nginx?

1 Answer 1

50

Yes, just have two access_log directives in the same block.

Since access_log in one block overrides any such directives in outer blocks, you have to copy and paste the directive from the outer block into the inner block if you need to log twice in an inner bock.

1
  • I know, this is ancient, but does it still work? If so, then what is the exact nginx.conf line for it?
    – Bert
    Mar 28, 2022 at 7:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .