2.6. 为 Ceph 对象网关创建和收集操作日志
用户身份信息添加到操作日志输出中。这用于使用户访问此信息以审核 S3 访问。跟踪 S3 请求在所有 Ceph 对象网关操作日志中可靠的用户身份。
流程
查找日志所在的位置:
语法
logrotate -f
示例
[root@host01 ~]# logrotate -f /etc/logrotate.d/ceph-12ab345c-1a2b-11ed-b736-fa163e4f6220
列出指定位置的日志:
语法
ll LOG_LOCATION
示例
[root@host01 ~]# ll /var/log/ceph/12ab345c-1a2b-11ed-b736-fa163e4f6220 -rw-r--r--. 1 ceph ceph 412 Sep 28 09:26 opslog.log.1.gz
列出当前的存储桶:
示例
[root@host01 ~]# /usr/local/bin/s3cmd ls
创建存储桶:
语法
/usr/local/bin/s3cmd mb s3://NEW_BUCKET_NAME
示例
[root@host01 ~]# /usr/local/bin/s3cmd mb s3://bucket1 Bucket `s3://bucket1` created
列出当前的日志:
语法
ll LOG_LOCATION
示例
[root@host01 ~]# ll /var/log/ceph/12ab345c-1a2b-11ed-b736-fa163e4f6220 total 852 ... -rw-r--r--. 1 ceph ceph 920 Jun 29 02:17 opslog.log -rw-r--r--. 1 ceph ceph 412 Jun 28 09:26 opslog.log.1.gz
收集日志:
语法
tail -f LOG_LOCATION/opslog.log
示例
[root@host01 ~]# tail -f /var/log/ceph/12ab345c-1a2b-11ed-b736-fa163e4f6220/opslog.log {"bucket":"","time":"2022-09-29T06:17:03.133488Z","time_local":"2022-09- 29T06:17:03.133488+0000","remote_addr":"10.0.211.66","user":"test1", "operation":"list_buckets","uri":"GET / HTTP/1.1","http_status":"200","error_code":"","bytes_sent":232, "bytes_received":0,"object_size":0,"total_time":9,"user_agent":"","referrer": "","trans_id":"tx00000c80881a9acd2952a-006335385f-175e5-primary", "authentication_type":"Local","access_key_id":"1234","temp_url":false} {"bucket":"cn1","time":"2022-09-29T06:17:10.521156Z","time_local":"2022-09- 29T06:17:10.521156+0000","remote_addr":"10.0.211.66","user":"test1", "operation":"create_bucket","uri":"PUT /cn1/ HTTP/1.1","http_status":"200","error_code":"","bytes_sent":0, "bytes_received":0,"object_size":0,"total_time":106,"user_agent":"", "referrer":"","trans_id":"tx0000058d60c593632c017-0063353866-175e5-primary", "authentication_type":"Local","access_key_id":"1234","temp_url":false}