nginx日誌格式


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

      #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’;

       其中,各個字段的含義如下:

       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 :記錄客戶端瀏覽器的相關信息;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章