如何在出现问题时分析ARTIFACTORY日志
在我们的日常活动中,我们在管理Artifactory应用程序时可能会遇到技术问题。在您向JFrog Support寻求帮助之前,您可以快速检查日志中可能的错误消息并自行修复它们。JFrog平台为所有JFrog产品及其服务提供日志记录hth华体会最新官方网站标准格式和命名约定.在JFrog平台发布版中,我们为每个单独的请求引入了“跟踪Id”,以了解事件的流程,这将有助于故障排除。
日志格式的示例及其示例条目
服务日志文件的记录结构
时间戳(UTC)[服务类型][级别][跟踪Id[类和行号][线程]-消息
服务日志文件记录样例
2022-09-23T15:39:04.902Z [jfac] [INFO] [4 b1b8a0b04e31b80] [s.r。NodeRegistryServiceImpl:44] [http-exec-4] -请求“加入”与serviceId jffe@000
请求日志文件记录结构
时间戳|跟踪ID|对端地址|用户名|请求方式|请求URL |返回状态|请求内容长度|响应内容长度|请求时长|请求用户代理
请求日志文件记录示例
2018 - 11 - 18 t15:39:04.902z |d5d75b3c41242768|127.0.0.1|anonymous|GET|api/v1/cert/root|200|0|6|0|JFrog Access Java客户端/4.1.12 . b
如果我们使用cURL部署一个简单的工件,下面是它的输出,以及来自不同微服务的基于跟踪id的相应日志条目。
$ curl -uadmin -X PUT http://jfrog.local/artifactory/example-repo-local/apache-log4j-2.13.3-bin.tar.gz -T ~/Downloads/apache-log4j-2.13.3-bin.tar.gz
输入用户“admin”的主机密码:{
"repo": "example-repo-local",
path: "/apache-log4j-2.13.3-bin.tar.gz",
"created": "2022-09-23T05:20:36.405Z",
createdBy: admin,
"downloadUri": "http://jfrog.local/artifactory/example-repo-local/apache-log4j-2.13.3-bin.tar.gz",
"mimeType": "application/x-gzip",
"size": "14378385"
"checksum ": {
"sha1": "a57ccf256b1e7c16832caeb73c503d297063a717",
"md5": "2414d75a46b114ece41f31fc21f27019",
"sha256": "5b86209c507063ba04db6b3797140cc31acfbbd6988255a5d359ab860341ffac"
},
" originalchecksum ": {
"sha256": "5b86209c507063ba04db6b3797140cc31acfbbd6988255a5d359ab860341ffac"
},
"uri": "http://jfrog.local/artifactory/example-repo-local/apache-log4j-2.13.3-bin.tar.gz"
}
artifactory服务日志有以下条目。
2022-09-23t05:19 . 49. 158z [jfrt] [INFO] [2 e896eb103b28d7c] [o.a.e。UploadServiceImpl:466] [http-nio-8081-exec-6] - Deploy to 'example-repo-local:apache-log4j-2.13.3-bin.tar.gz' Content-Length: 14378385 (estimate) artificial: false
如果我们使用上面的跟踪id(2 e896eb103b28d7c)并搜索它,然后我们从不同的微服务日志中得到所有相关的条目。
$ grep -iR 2e896eb103b28d7c /opt/jfrog/artifactory/var/log/* .使用实例
access-request.log:
2022-09-23T05:19:49.040Z|2e896eb103b28d7c|127.0.0.1|jfrt@01gdmb9y0z1x2a1qg5tz970xcx|GET|/access/api/v1/users/admin|200|520|-1|5|JFrog access Java Client/7.45.4 74504900 Artifactory/7.41.13 74113900
2022-09-23T05:19:49.055Z|2e896eb103b28d7c|127.0.0.1|匿名|POST|/access/api/v1/auth/authenticate|200|520|44|12|JFrog access Java Client/7.45.4 74504900 Artifactory/7.41.13 74113900
2022 - 09 - 23 t05:20:36.443z e896eb103b28d7c | 2 | / 127.0.0.1:45992 | jfrt@01gdmb9y0z1x2a1qg5tz970xcx | una | com.jfrog.access.v1.config.PlatformConfigResource / GetConfig | 0 | 1 | 1 | 2 | grpc-java-netty / 1.43.2
artifactory-access.log:
2022-09-23T05:20:36.464Z [2e896eb103b28d7c] [接受部署]example-repo-local: apache-log4j-2.13.3-bin.tar.gz客户端:admin / X.X.X.X.
2022-09-23t05:20 . 36. 511z [2e896eb103b28d7c] [ACCEPTED LOGIN] for client: admin / x.x.x.x。
artifactory-request.log:
2022 - 09 - 23 t05:20:36.511z e896eb103b28d7c | 2 | x.x.x.x |管理|把| / example-repo-local /apache-log4j-2.13.3-bin.tar.gz | 201| 14378385 | 0 | 47488 |旋度/ 7.79.1
artifactory-service.log:
2022-09-23T05:19:49.158Z [jfrt] [INFO] [2e896eb103b28d7c] [o.a.e。UploadServiceImpl:466] [http-nio-8081-exec-6] - Deploy to 'example-repo-local:apache-log4j-2.13.3-bin.tar.gz' Content-Length: 14378385 (estimate) artificial: false
router-request.log:
{“ClientAddr”:“127.0.0.1:41318”、“DownstreamContentSize”:520年,“DownstreamStatus”:200,"Duration":13212759,"RequestMethod":"POST","RequestPath":"/access/api/v1/auth/authenticate","ServiceAddr":"localhost:8040","StartUTC":" 2022-09-23t05:19 . 49.041958729z ","level":"info","msg":"" request_super - trace - id ":"2e896eb103b28d7c:51cc7e85f6d65b90:2b5eb23f45e4063a:0","request_User-Agent":"JFrog access Java Client/7.45.4 74504900 Artifactory/7.41.13 74113900","time":" 2022-09-23t05:19 - 49z "}
{“ClientAddr”:“127.0.0.1:34996”、“DownstreamContentSize”:5”DownstreamStatus”:200,“持续时间”:4256554,“RequestMethod”:“文章”、“RequestPath”:“/ com.jfrog.access.v1.config.PlatformConfigResource / GetConfig”、“ServiceAddr”:“localhost: 8045”、“StartUTC”:“2022 - 09 - 23 t05:20:36.439796236z”、“水平”:“信息”、“味精”:“”,“request_Uber-Trace-Id”:“2 e896eb103b28d7c: 78702 db25f262dea: 59 e20ef7f6b2a20a: 0”、“request_User-Agent”:“grpc-java-netty / 1.43.2”,“时间”:“2022 - 09 - 23 - t05:20:36z”}
{“ClientAddr”:“x.x.x.x: 41979”,“DownstreamContentSize”:747年,“DownstreamStatus”:201,“持续时间”:47515293186,“RequestMethod”:“把”、“RequestPath”:“/ artifactory example-repo-local / apache-log4j-2.13.3-bin.tar.gz”、“ServiceAddr”:“localhost: 8081”、“StartUTC”:“2022 - 09 - 23 t05:19:49.02210776z”、“水平”:“信息”、“味精”:“”、“request_Uber-Trace-Id”:“2 e896eb103b28d7c: 7 dc5f74cb7dd1f6e: 2 e896eb103b28d7c: 0”、“request_User-Agent”:“旋度/ 7.79.1”、“时间”:“2022 - 09 - 23 t05:20:36z "}
考虑一个例子,其中文件上传在UI最大大小(MB)设置为100MB(默认)
如果我们尝试使用UI上传一个大于这个大小的文件(例如:256.9 MB),我们会在UI中得到以下错误。
jfrog-artifactory-pro-6.23.38.zip文件大小超过限制(100Mb)
Artifactory日志将有以下条目。我们需要检查所有其他微服务的日志,以了解事件的流程,因为问题可能发生在任何地方。
2022-09-23T05:36:49.199Z [jfrt] [ERROR] [27 cdfbdf8f906e0d] [o.a.w.s。RepoFilter:315] [http-nio-8081-exec-3] - sample -repo-local:jfrog-artifactory-pro-6.23.38.zip上传请求失败,原因是{}
org.jfrog.storage.binstore.ifc.ClientInputStreamException: Failed to read stream: java.io.EOFException$ grep -iR 27cdfbdf8f906e0d /opt/jfrog/artifactory/var/log/* .使用实例
access-request.log:
2022-09-23T05:35:32.362Z|27cdfbdf8f906e0d|127.0.0.1|jfrt@01gdmb9y0z1x2a1qg5tz970xcx|GET|/access/api/v1/users/admin|200|520|-1|4|JFrog access Java Client/7.45.4 74504900 Artifactory/7.41.13 74113900
2022-09-23T05:35:32.437Z|27cdfbdf8f906e0d|127.0.0.1|anonymous|POST|/access/api/v1/auth/authenticate|200|520|44|72|JFrog access Java Client/7.45.4 74504900 Artifactory/7.41.13 74113900
artifactory-access.log:
2022-09-23T05:36:49.223Z [27cdfbdf8f906e0d] [ACCEPTED LOGIN] for client: admin / x.x.x.x。
artifactory-request.log:
2022 - 09 - 23 t05:36:49.223z | 27 cdfbdf8f906e0d | x.x.x.x |管理|把| / example-repo-local jfrog-artifactory-pro-6.23.38.zip | 404 | 265618412 | 0 | 76877 |旋度/ 7.79.1
artifactory-service.log:
2022-09-23T05:35:32.444Z [jfrt] [INFO] [27cdfbdf8f906e0d] [o.a.e。UploadServiceImpl:466] [http-nio-8081-exec-3] - Deploy to 'example-repo-local:jfrog-artifactory-pro-6.23.38.zip' Content-Length: 265618412 (estimation) artificial: false
2022-09-23T05:36:49.199Z [jfrt] [ERROR] [27cdfbdf8f906e0d] [o.a.w.s。RepoFilter:315] [http-nio-8081- exec3] -上传sample -repo-local:jfrog-artifactory-pro-6.23.38.zip请求失败{}
2022-09-23T05:36:49.220Z [jfrt][警告][27cdfbdf8f906e0d] [o.a.w.s。RepoFilter:316] [http-nio-8081-exec-3] -发送HTTP错误码404:Failed to read stream: java.io.EOFException
上面的例子是一个简单的用例。在大多数情况下,我们可以通过简单地检查请求流并在事件流期间查找错误/警告来了解问题的根本原因。
