nginx日誌格式


      Nginx中日誌文件的格式在nginx.conf中定義,其默認格式以下:nginx

      #vim /usr/local/nginx/conf/nginx.conf
          log_format access ‘$remote_addr – $remote_user [$time_local] 「$request」 ‘‘$status $body_bytes_sent 「$http_referer」 ‘‘」$http_user_agent」 $http_x_forwarded_for’;
vim

       其中,各個字段的含義以下:瀏覽器

       1.$remote_addr 與$http_x_forwarded_for 用以記錄客戶端的ip地址;
        2.$remote_user :用來記錄客戶端用戶名稱;
        3.$time_local : 用來記錄訪問時間與時區;
        4.$request : 用來記錄請求的url與http協議;
        5.$status : 用來記錄請求狀態;成功是200,
        6.$body_bytes_s ent :記錄發送給客戶端文件主體內容大小;
        7.$http_referer :用來記錄從那個頁面連接訪問過來的;
        8.$http_user_agent :記錄客戶端瀏覽器的相關信息;
ide

相關文章
相關標籤/搜索