httpd 방문자 수 체커

2018.01.22 02:00

cybertramp LANG/Python3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Written by Cybertramp
 
visit_ip = []
 
with open('/var/log/httpd/access_log','r')as f:
    logs = f.readlines()
    for log in logs:
        log = log.split()
        ip = log[0]
        if ip not in visit_ip:
            visit_ip.append(ip)
 
print('고유 방문자 수:[%d]'%len(visit_ip))
 
cs