728x90
반응형

log 7

Kubernetes Envoy로 Header 로깅하기 (Ingress 연동)

구조는 아래 이미지와 같다. 호출 → Ingress → Envoy Service → Envoy Pod(로그 기록) → Backend Service → Pod 테스트용 백앤드 서비스 생성kubectl create deployment service-1 --image=nginx --replicas=1kubectl create deployment service-2 --image=nginx --replicas=1kubectl create deployment service-3 --image=nginx --replicas=1kubectl expose deployment service-1 --port=80 --target-port=80kubectl expose deployment service-2 --port=80..

Kubernetes/envoy 2026.03.02

nginx header log (custom header 사용)

nginx.conf 파일에서 $header_을 사용하면 된다. custom header가 제대로 나오고 있는지 확인하기 위해 custom header 값으로 로그를 찍는 테스트를 진행해 봤다. python 테스트 코드 import requests def getAuthHeader(): # http 호출 헤더값 설정 http_header = { 'test': 'test-header', 'key': 'test-key', } return http_header #header 생성 http_header = getAuthHeader() #nginx가 있는 서버 ip 입력 response = requests.get('http://serverip', headers=http_header) print (response) n..

Nginx 2023.12.11

nginx log 경로 변경 후 오류 (13: Permission denied) while logging request

nginx에서 log를 남길 때 로그 파일이름을 $hostname-access.log / error.log의 형태로 남기고 있었다. 테스트를 위해 log 경로를 수정했는데 $hostname-access.log는 하나도 남지 않고 error.log만 잔뜩 쌓여있었다. error.log를 확인해 봤더니 아래처럼 Permission denied 에러가 발생하고 있었다. 2023/07/11 16:55:58 [crit] 68792#68792: *1 open() "/var/log/nginx/test-virtual-machine-access.log" failed (13: Permission denied) while logging request, client: {ip}, server: , request: "GET / ..

Nginx 2023.07.11

this action would add [1] total shards, but this cluster currently has [1000]/[1000] maximum shards open

보통 kibana에서 elasticsearch 로그를 가져와서 화면에 보여주곤 한다. 갑자기 kibana에서 특정 index 값이 나오지 않는다면 elastic 서버에 접속해서 로그를 확인해 보면 아래 오류 메시지가 발생하는 경우가 있다, 오류내용 this action would add [1] total shards, but this cluster currently has [1000]/[1000] maximum shards open 해당 내용은 elasticsearch에서 사용하는 shard max값이 1000개인데 현재 shard를 다 사용했다는 뜻이다. 해결 방법은 간단하다. shard의 갯수를 늘려주면 된다. Trouble Shooting 방법 #현재 shard 확인 curl --user '{id}..

Elasticsearch 2023.06.22

Haproxy log 설정

생성할 조건 haproxy.log를 일별로 30일 동안 생성 로그를 남기는 원리 - rsyslog haproxy는 rsyslog를 통해서 로그를 남겨야 한다. - logrotate logrotate는 log를 일자별로 생성해준다. haproxy.log를 haproxy.log-yyyymmdd로 파일을 변경 기존 haproxy.log는 /dev null처리를 해준다. 로그 생성 방법 1. rsyslog를 통해 haproxy로그를 남길 수 있도록 세팅 vi /etc/rsyslog.d/haproxy.conf $AddUnixListenSocket /var/lib/haproxy/dev/log # Send HAProxy messages to a dedicated logfile if $programname starts..

Haproxy 2023.06.15

Grafana log level, log 보관 기간 수정

1. log level 수정 - 아래 ;level = info에서 주석(;)을 풀고 debug, error 등 원하는 log level을 설정한다. (기본은 info level로 설정된다) /etc/grafana/grafana.ini 파일 수정 #################################### Logging ########################## [log] # Either "console", "file", "syslog". Default is console and file # Use space to separate multiple modes, e.g. "console file" ;mode = console file # Either "trace", "debug", "info", "..

Prometheus metric 보관 주기 변경

1. system service로 운영 중인 prometheus - 보관 주기를 설정하지 않으면 기본 보관 주기 15d로 설정된다. - metric 보관 기간을 늘리고 싶다면 --storage.tsdb.retention.time=1y를 추가해 주면 된다. vi /etc/systemd/system/prometheus.service # 또는 vi /usr/lib/systemd/system/prometheus.service # 등등 [Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=/usr/l..

728x90
반응형