nice-bt-isucon / secret-sauce

0 stars 0 forks source link

各種ログの設定を秘伝のたれに追加する #1

Open kakeru-one opened 1 week ago

kakeru-one commented 1 week ago

Nginx

記述確認

nginx -t

etc/nginx/nginx.conf

- access_log /var/log/nginx/access.log;
+ log_format json escape=json '{"time":"$time_iso8601",'
+                             '"host":"$remote_addr",'
+                            '"port":"$remote_port",'
+                            '"method":"$request_method",'
+                            '"uri":"$request_uri",'
+                            '"status":"$status",'
+                            '"body_bytes":"$body_bytes_sent",'
+                            '"referer":"$http_referer",'
+                            '"ua":"$http_user_agent",'
+                            '"request_time":"$request_time",'
+                            '"response_time":"$upstream_response_time"}';
+  access_log /var/log/nginx/access.log json;

MySQL

etc/mysql/mysql.conf.d/mysql.cnf

+ [mysqld]
+ character-set-server=utf8mb4
+ slow_query_log = 1
+ slow_query_log_file = /var/log/mysql/mysql-slow.log
+ long_query_time = 0
[mysql]
+ default-character-set=utf8mb4
+ [client]
+ default-character-set=utf8mb4
kakeru-one commented 1 week ago
log_format json escape=json '{"time":"$time_iso8601",'
                            '"host":"$remote_addr",'
                           '"port":"$remote_port",'
                           '"method":"$request_method",'
                         '"uri":"$request_uri",'
                          '"status":"$status",'
                           '"body_bytes":"$body_bytes_sent",'
                           '"referer":"$http_referer",'
                           '"ua":"$http_user_agent",'
                           '"request_time":"$request_time",'
                           '"response_time":"$upstream_response_time"}';
 access_log /var/log/nginx/access.log json;

mysqlのdiffなし

[mysqld]
character-set-server=utf8mb4
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 0
[mysql]
default-character-set=utf8mb4
[client]
default-character-set=utf8mb4