IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 网络协议 -> traefik accesslog Duration字段说明 -> 正文阅读

[网络协议]traefik accesslog Duration字段说明

traefik accesslog Duration字段说明

有访问日志如下:

{
  "ClientAddr": "10.6.36.11:29084",
  "ClientHost": "10.6.36.11",
  "ClientPort": "29084",
  "ClientUsername": "-",
  "DownstreamContentSize": 19,
  "DownstreamStatus": 404,
  "Duration": 195982,
  "OriginContentSize": 19,
  "OriginDuration": 14847,
  "OriginStatus": 404,
  "Overhead": 181135,
  "RequestAddr": "api.by.com",
  "RequestContentSize": 0,
  "RequestCount": 74869,
  "RequestHost": "api.by.com",
  "RequestMethod": "GET",
  "RequestPath": "/",
  "RequestPort": "-",
  "RequestProtocol": "HTTP/1.1",
  "RequestScheme": "http",
  "RetryAttempts": 0,
  "StartLocal": "2021-09-10T16:34:24.142707156+08:00",
  "StartUTC": "2021-09-10T08:34:24.142707156Z",
  "downstream_Content-Type": "text/plain; charset=utf-8",
  "downstream_X-Content-Type-Options": "nosniff",
  "entryPointName": "web",
  "level": "info",
  "msg": "",
  "origin_Content-Type": "text/plain; charset=utf-8",
  "origin_X-Content-Type-Options": "nosniff",
  "request_Accept": "*/*",
  "request_My_name": "haifeng",
  "request_User-Agent": "curl/7.29.0",
  "request_X-Forwarded-Host": "api.by.com",
  "request_X-Forwarded-Port": "80",
  "request_X-Forwarded-Proto": "http",
  "request_X-Forwarded-Server": "k8s-node-56-161.by.com",
  "request_X-Real-Ip": "10.6.36.11",
  "time": "2021-09-10T16:34:24+08:00"
}

观察"Duration": 195982"OriginDuration": 14847,这两个值的单位是什么呢?

在官方文档中没有查到,源码中搜索了下,解释如下。

各字段说明

| Field                   | Description                                                                                                                                                         |
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `StartUTC`              | The time at which request processing started.                                                                                                                       |
| `StartLocal`            | The local time at which request processing started.                                                                                                                 |
| `Duration`              | The total time taken (in nanoseconds) by processing the response, including the origin server's time but not the log writing time.                                  |
| `RouterName`            | The name of the Traefik  router.                                                                                                                                    |
| `ServiceName`           | The name of the Traefik backend.                                                                                                                                    |
| `ServiceURL`            | The URL of the Traefik backend.                                                                                                                                     |
| `ServiceAddr`           | The IP:port of the Traefik backend (extracted from `ServiceURL`)                                                                                                    |
| `ClientAddr`            | The remote address in its original form (usually IP:port).                                                                                                          |
| `ClientHost`            | The remote IP address from which the client request was received.                                                                                                   |
| `ClientPort`            | The remote TCP port from which the client request was received.                                                                                                     |
| `ClientUsername`        | The username provided in the URL, if present.                                                                                                                       |
| `RequestAddr`           | The HTTP Host header (usually IP:port). This is treated as not a header by the Go API.                                                                              |
| `RequestHost`           | The HTTP Host server name (not including port).                                                                                                                     |
| `RequestPort`           | The TCP port from the HTTP Host.                                                                                                                                    |
| `RequestMethod`         | The HTTP method.                                                                                                                                                    |
| `RequestPath`           | The HTTP request URI, not including the scheme, host or port.                                                                                                       |
| `RequestProtocol`       | The version of HTTP requested.                                                                                                                                      |
| `RequestScheme`         | The HTTP scheme requested `http` or `https`.                                                                                                                        |
| `RequestLine`           | `RequestMethod` + `RequestPath` + `RequestProtocol`                                                                                                                 |
| `RequestContentSize`    | The number of bytes in the request entity (a.k.a. body) sent by the client.                                                                                         |
| `OriginDuration`        | The time taken (in nanoseconds) by the origin server ('upstream') to return its response.                                                                           |
| `OriginContentSize`     | The content length specified by the origin server, or 0 if unspecified.                                                                                             |
| `OriginStatus`          | The HTTP status code returned by the origin server. If the request was handled by this Traefik instance (e.g. with a redirect), then this value will be absent.     |
| `OriginStatusLine`      | `OriginStatus` + Status code explanation                                                                                                                            |
| `DownstreamStatus`      | The HTTP status code returned to the client.                                                                                                                        |
| `DownstreamStatusLine`  | `DownstreamStatus` + Status code explanation                                                                                                                        |
| `DownstreamContentSize` | The number of bytes in the response entity returned to the client. This is in addition to the "Content-Length" header, which may be present in the origin response. |
| `RequestCount`          | The number of requests received since the Traefik instance started.                                                                                                 |
| `GzipRatio`             | The response body compression ratio achieved.                                                                                                                       |
| `Overhead`              | The processing time overhead (in nanoseconds) caused by Traefik.                                                                                                    |
| `RetryAttempts`         | The amount of attempts the request was retried.                                                                                                                     |
| `TLSVersion`            | The TLS version used by the connection (e.g. `1.2`) (if connection is TLS).                                                                                         |
| `TLSCipher`             | The TLS cipher used by the connection (e.g. `TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA`) (if connection is TLS)                                                           |

可以看到DurationOriginDuration的单位是nanoseconds。如果想让其在日志系统中显示得友好一些,可以在收集日志时将其转换为秒。

参考

  • https://github.com/traefik/traefik/blob/master/docs/content/observability/access-logs.md
  网络协议 最新文章
使用Easyswoole 搭建简单的Websoket服务
常见的数据通信方式有哪些?
Openssl 1024bit RSA算法---公私钥获取和处
HTTPS协议的密钥交换流程
《小白WEB安全入门》03. 漏洞篇
HttpRunner4.x 安装与使用
2021-07-04
手写RPC学习笔记
K8S高可用版本部署
mySQL计算IP地址范围
上一篇文章      下一篇文章      查看所有文章
加:2021-09-14 13:44:27  更:2021-09-14 13:46:42 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/26 0:43:58-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码