Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- AnimatedPositioned
- 무선 디버깅
- Linux
- go
- User
- version 2
- openrc
- option pattern
- SQL Server
- pg_stat_statements
- log
- Flutter
- 윈도우즈 터미널
- 맥미니
- opentelemetry
- DotNet
- sqlc
- user-secrets
- elasticSearch
- docker
- Android
- otel
- rc-service
- shared_preload_libraries
- 옵션 패턴
- IDX Project
- vscode
- mysql
- golang
- module upgrade
Archives
- Today
- Total
CATCHV Blog
[Grafana] loki logcli 사용법 본문
반응형
1. 설치
https://github.com/grafana/loki/releases 에서 플랫폼에 맞는 것을 다운로드 받는다.
# 다운로드 받기
$ wget https://github.com/grafana/loki/releases/download/v2.7.4/logcli-linux-amd64.zip
# 압축 해제
$unzip logcli-linux-amd64.zip
2. logcli에서 사용할 loki를 설정한다.
# export LOKI_ADDR=http://<loki 서버 주소>:<loki http port>
export LOKI_ADDR=http://loki:3100
3. loki의 설정된 job 리스트 확인
$ ./logcli-linux-amd64 labels job
2023/03/08 04:48:29 http://loki:3100/loki/api/v1/label/job/values?end=1678250909484905582&start=1678247309484905582
varlogs
4. job에 저장된 데이터 확인
( varlogs 저장된 데이터는 mysql의 errorlog를 저장하고 있음 )
$ ./logcli-linux-amd64 query '{job="varlogs"}'
2023/03/08 04:50:19 http://loki:3100/loki/api/v1/query_range?direction=BACKWARD&end=1678251019157484315&limit=30&query=%7Bjob%3D%22varlogs%22%7D&start=1678247419157484315
2023/03/08 04:50:19 Common labels: {filename="/var/log/mysqld.log", job="varlogs"}
2023-03-08T04:50:13Z {} 2023-03-08T04:50:12.844220Z 50 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2023-03-08T04:49:52Z {} 2023-03-08T04:49:52.844485Z 49 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
반응형
Comments