차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
tech:var_log [2022/11/28 02:44] – 제거됨 - 바깥 편집 (Unknown date) 127.0.0.1tech:var_log [2022/11/28 02:49] (현재) – [우분투] V_L
줄 1: 줄 1:
 +{{tag> log }}
 +====== /var/log  ======
 +
 +줄여봅시다.
 +
 +  ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF
 +
 +=====우분투 =====
 +
 +
 +확인
 +   du -hd 1 /var/log
 +====/var/log/journal====
 +
 +''/var/log/journal'' 오래 켜놓을 수록 크기가 커진다.  기본적으로 계속 커진다. 
 +
 +
 +<file>
 +/var/log$ sudo du -hd 1
 +4.1G    ./journal
 +180K    ./apt
 +44K     ./samba
 +20K     ./letsencrypt
 +</file>
 +
 +''4.1G'' 아니 뭐 이런 개*@!@#
 +
 +
 +
 +
 +
 +
 +
 +''/etc/systemd/journald.conf'' 파일을 수정하여, 한계 크기를 설정하자.
 +
 +  SystemMaxUse=20M
 +
 +디스크 사용량 보기
 +
 +  journalctl --disk-usage
 +  Archived and active journals take up 80.0M in the file system.
 +  
 +자세한 설정은 [[https://www.loggly.com/ultimate-guide/linux-logging-with-systemd/#journald-configuration|참조]]
 +
 +변경 후 재시작
 +   systemctl restart systemd-journald
 +
 +====Nginx====
 +
 +접근 로그는 ''nginx.conf''에서 설정하는 것이 편하다.
 +  access_log off;
 +에러 로그도 끌 수 있다. 
 +  error_log off;
 +  
 +  
 +====Samba====
 +[[tech:samba|]]는 
 +''/etc/samba/smb.conf''에서 글로벌 섹션에 로그레벨을 ''0''(안함) 으로 설정.
 +
 +[[https://www.oreilly.com/openbook/samba/book/ch04_08.html|설정]]참고.
 +
 +<file>
 +  [global]
 +  # Sets the amount of log/debug messages that are sent to the log file. 0 is none, 3 is consi>
 +  log level = 0
 +</file>
 +
 +그리고 삼바 재시작 
 +    service smbd restart
 +====Certbot====
 +[[tech:letsencrypt|]]은 자동으로 매일 2회 갱신을 시도하는데, 갱신기한이 1개월 남았을 때만 실제로 갱신이 이루어지므로 하루 두번은 불필요하다고 생각되면, 변경하자.
 +
 +''/etc/cron.d/certbot''파일을 수정한다.
 +
 +매월 1일로 변경
 +  0 0 1 * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
 +
 +
 +
 +
 +
 +====  ubuntu-advantage ====
 +우분투 유료 서비스를 관리하는 패키지인데, 사용하지 않더라도 삭제하는 것은 권장하지 않는다. 
 +로깅만 막자.
 +
 +''/etc/ubuntu-advantage/uaclient.conf'' 
 +
 +  log_level: debug
 +
 +을 ''off''로 변경
 +
 +    log_level: off
 +
 +그리고 
 +   ua refresh
 +====cron====
 +
 +[[https://languor.us/cron-pam-unix-cron-session-session-opened-closed-user-root-uid0|참조]]
 +
 +  * Go to the ''/etc/pam.d'' directory.
 +  * Open the file ''common-session-noninteractive'' in an editor.
 +  * Look for the following line:
 +
 +  session required        pam_unix.so
 +
 +  * Above this line, add the following:
 +
 +  session     [success=1 default=ignore] pam_succeed_if.so service in cron quiet use_uid
 +
 +  * Save the file and exit.
 +  * Restart crond using something like 
 +
 +  service cron restart
 +=====프록스목스=====
 +
 +====pveproxy====
 +
 +
 +
 +<file>
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:07 +0900] "GET /api2/json/cluster/resources HTTP/1.1" 200 870
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:10 +0900] "GET /api2/json/cluster/tasks HTTP/1.1" 200 1009
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:11 +0900] "GET /api2/json/nodes/play/status HTTP/1.1" 200 761
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:11 +0900] "GET /api2/json/cluster/resources HTTP/1.1" 200 858
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:14 +0900] "GET /api2/json/cluster/tasks HTTP/1.1" 200 1024
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:15 +0900] "GET /api2/json/cluster/resources HTTP/1.1" 200 857
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:17 +0900] "GET /api2/json/nodes/play/status HTTP/1.1" 200 755
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:18 +0900] "GET /api2/json/cluster/tasks HTTP/1.1" 200 1024
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:19 +0900] "GET /api2/json/cluster/resources HTTP/1.1" 200 857
 +::ffff:192.168.0.253 - root@pam [22/11/2022:23:33:22 +0900] "GET /api2/json/cluster/tasks HTTP/1.1" 200 1024
 +</file>
 +