C
C
copal2015-12-19 19:50:22
Nginx
copal, 2015-12-19 19:50:22

How to display "this" in log_format?

$.ajax({
  url: 'http://api.domen.ru/dir',
  type: 'POST',
  contentType: 'application/json',
  data: JSON.stringify({
      name: 'some name'
  })
});

How to display the transferred data in log_format? That is, my log_format writes to a file and outputs data to the console. What should be written in the config to display the transferred values?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2015-12-19
@copal

www.stackoverflow.com/a/14034744

location /dir {
  log_format postdata $request_body;
  access_log /var/log/nginx/access.log postdata;
  echo_read_request_body;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question