hey i am currently just to get the data from the file
for example here a line from the file
Jan 10 09:32:07 j4-be03 sshd[3876]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=218.241.173.35 user=root
here the current code i am using but cant seem to achieve it when am spliting it
for line in myFile:
list_of_line = line.split()
date = list_of_line[0:3]
print '\'',date,'\''
if login_ctns.has_key(date):
login_counts = login_ctns[date]
login_counts = login_counts +1
login_ctns[date] = login_counts
#zero out the temporary counter as a precaution
count_login =0
else:
login_ctns[date] = 1
print date
Your code is making
datea list, which can’t be used as a dict key.Try:
instead.