Skip to content

Commit 95de473

Browse files
Update util script
Signed-off-by: Lukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot)
1 parent f191a88 commit 95de473

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

utils/count_apis.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
if [ -z "${1}" ]
66
then
7-
echo "Usage: $0 <path-to-api-logs>"
7+
echo "Usage: $0 <path-to-api-logs> [min-count]"
88
echo "Example: $0 api-logs-prod.json"
99
exit 1
1010
fi
11-
11+
N=10
12+
if [ ! -z "${2}" ]
13+
then
14+
N="${2}"
15+
fi
1216
jq -r '
1317
.[].message
1418
| capture("LG:api-request-path:(?<p>[^\"[:space:]]+)")? # find the path
@@ -29,4 +33,5 @@ jq -r '
2933
| sed -E 's#/(00|a0)[A-Za-z0-9]{13,16}(/|$)#/<sfid>\2#g' \
3034
| sed -E 's#/lf[A-Za-z0-9]{16,22}(/|$)#/<lfxid>\1#g' \
3135
| sed -E 's#/null(/|$)#/<null>\1#g' \
32-
| sort | uniq -c | sort -nr
36+
| sort | uniq -c | sort -nr \
37+
| awk -v N="$N" '$1 >= N'

0 commit comments

Comments
 (0)