Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/administration/troubleshooting/log_parsing.md')
-rw-r--r--doc/administration/troubleshooting/log_parsing.md43
1 files changed, 33 insertions, 10 deletions
diff --git a/doc/administration/troubleshooting/log_parsing.md b/doc/administration/troubleshooting/log_parsing.md
index 4e9e8cd591f..144aa0f6d3b 100644
--- a/doc/administration/troubleshooting/log_parsing.md
+++ b/doc/administration/troubleshooting/log_parsing.md
@@ -1,7 +1,7 @@
---
-stage: none
-group: unassigned
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
+stage: Enablement
+group: Distribution
+info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Parsing GitLab logs with `jq`
@@ -143,16 +143,39 @@ jq 'select(."grpc.code" != null and ."grpc.code" != "OK")' current
jq 'select(."grpc.time_ms" > 30000)' current
```
-#### Print top three projects by request volume and their three longest durations
-
-```shell
-jq -s -r 'map(select(."grpc.request.glProjectPath" != null and ."grpc.request.glProjectPath" != "" and ."grpc.time_ms" != null)) | group_by(."grpc.request.glProjectPath") | sort_by(-length) | limit(3; .[]) | sort_by(-."grpc.time_ms") | "CT: \(length)\tPROJECT: \(.[0]."grpc.request.glProjectPath")\tDURS: \(.[0]."grpc.time_ms"), \(.[1]."grpc.time_ms"), \(.[2]."grpc.time_ms")"' current
+#### Print top ten projects by request volume and their three longest durations
+
+```shell
+jq --raw-output --slurp '
+ map(
+ select(
+ ."grpc.request.glProjectPath" != null
+ and ."grpc.request.glProjectPath" != ""
+ and ."grpc.time_ms" != null
+ )
+ )
+ | group_by(."grpc.request.glProjectPath")
+ | sort_by(-length)
+ | limit(10; .[])
+ | sort_by(-."grpc.time_ms")
+ | [
+ length,
+ .[0]."grpc.time_ms",
+ .[1]."grpc.time_ms",
+ .[2]."grpc.time_ms",
+ .[0]."grpc.request.glProjectPath"
+ ]
+ | @sh' /var/log/gitlab/gitaly/current \
+| awk 'BEGIN { printf "%7s %10s %10s %10s\t%s\n", "CT", "MAX DURS", "", "", "PROJECT" }
+ { printf "%7u %7u ms, %7u ms, %7u ms\t%s\n", $1, $2, $3, $4, $5 }'
```
**Example output**
```plaintext
-CT: 635 PROJECT: groupA/project1 DURS: 4292.269, 4228.853, 2885.548
-CT: 462 PROJECT: groupB/project5 DURS: 4368.981, 3623.553, 361.399
-CT: 455 PROJECT: groupC/project7 DURS: 387.295, 381.874, 373.988
+ CT MAX DURS PROJECT
+ 206 4898 ms, 1101 ms, 1032 ms 'groupD/project4'
+ 109 1420 ms, 962 ms, 875 ms 'groupEF/project56'
+ 663 106 ms, 96 ms, 94 ms 'groupABC/project123'
+ ...
```