
저는 CentOS 5.5를 사용하고 있으며 기본적으로 /var/log/audit/audit.log
다음과 같습니다.
type=USER_AUTH msg=audit(1331897657.359:8435): user pid=15610 uid=0 auid=4294967295 subj=system_u:system_r:unconfined_t:s0-s0:c0.c1023 msg='PAM: authentication acct="?" : exe="/usr/sbin/sshd" (hostname=c165-130.i02-2.onvol.net, addr=213.165.165.130, terminal=ssh res=failed)'
type=USER_LOGIN msg=audit(1331897657.360:8436): user pid=15610 uid=0 auid=4294967295 subj=system_u:system_r:unconfined_t:s0-s0:c0.c1023 msg='acct="oracle": exe="/usr/sbin/sshd" (hostname=?, addr=213.165.165.130, terminal=sshd res=failed)'
정확하게 말하면 로그 항목은 타임스탬프 없이 기록되므로 문제 해결이 더 어려워집니다. 사용 가능한 매뉴얼 페이지가 있습니다
man auditd.conf
하지만 이 주제에서 말하는 것은 다음과 같습니다.
log_format
The log format describes how the information should be stored on
disk. There are 2 options: raw and nolog. If set to RAW, the
audit records will be stored in a format exactly as the kernel
sends it. If this option is set to NOLOG then all audit informa-
tion is discarded instead of writing to disk. This mode does not
affect data sent to the audit event dispatcher.
모든 항목의 시작 부분에 날짜/시간을 인쇄하도록 어떻게 구성합니까?
답변1
사람이 분석할 수 있는 날짜 형식으로 감사 로그를 만들기 위해 설정할 수 있는 옵션은 없지만, 'ausearch' 명령을 사용하여 감사 로그를 검색하는 경우 -i
사람이 읽을 수 있는(아마도 약간) 생성하는 옵션이 있습니다. 사람이 더 읽기 쉬움) 출력.
ausearch -ts today
예를 들어, 새로 부팅한 시스템에서 실행하면 다음이 표시됩니다.
# ausearch -ts today
----
time->Mon Mar 19 23:07:00 2012
type=DAEMON_START msg=audit(1332212820.421:3834): auditd start, ver=2.1.3 format=raw kernel=3.2.10-3.fc16.x86_64 auid=4294967295 pid=6438 subj=system_u:system_r:auditd_t:s0 res=success
하지만 실행하면 ausearch -ts today -i
다음이 표시됩니다.
# ausearch -ts today -i
----
type=DAEMON_START msg=audit(03/19/2012 23:07:00.421:3834) : auditd start, ver=2.1.3 format=raw kernel=3.2.10-3.fc16.x86_64 auid=unset pid=6438 subj=system_u:system_r:auditd_t:s0 res=success
그게 당신에게 효과가 있나요? ausearch
어쨌든 감사 기록을 보는 데 이 방법을 사용하게 될 것입니다. -i
또한 uid->사용자 이름 조회 및 기타 해결과 같은 작업도 수행합니다.
편집하다: 위에서 보면 Fedora 16을 사용하고 있는 것을 알 수 있는데, ausearch -i
RHEL5에도 마찬가지입니다.
답변2
시작 부분의 긴 숫자는 타임스탬프입니다. 에포크 이후의 초 단위입니다. 몇 분 전에 다음을 받았습니다.
[0 1128 18:09:57] ~ % date +%s; date
1331917801
Fri Mar 16 18:10:01 CET 2012
숫자를 더 읽기 쉬운 숫자로 변환하려면 다음을 시도해 보세요.
[0 1133 18:12:41] ~ % date -d @1331897657
Fri Mar 16 12:34:17 CET 2012
sed
(따라서 1초 미만의 부분을 잘라내려면 "일반적인 트릭"이 필요할 것 같습니다 .)
SE 지원 기계가 없지만 sealert -a
타임스탬프를 사람이 읽을 수 있는 것으로 구문 분석할 수도 있습니까?
답변3
ausearch -i
도움말에서:
-i,--interpret Interpret results to be human readable
그건 정답이 아니야jsbillings썼다.
tail -f 를 실행할 필요가 없습니다!
PS 젠장 스택 포인트! 그래서 댓글을 달 수도, 추천을 할 수도 없었습니다.
답변4
tail -f /var/log/audit/audit.log | ausearch -i