The only wait you obtain the bestiary if is you are online, in case you wanna do the bestiary on 2 or more characters The safe way is by logging out in a place of "Not Loggout Zones", so if you logout your char will permant "on" so you will be sure to gain it.
I can tell you by my own experience:
Somedays ago I was in HOD, and I died and I loggout by mistake, I was sure I was not going to get any reward, but when i conect back my friends killed the boss and I got my exp and loot surprisely, even when i logout by mistake for a second, so what I means is if you attacked a monster or boss the damage will count to get the exp/bestiary/loot only if you are online when it dies.
Same happens when I was hunting and I logout and enter back. I got experience standing on depot cuz someone took the cave, but is like the damage is "active" if you are online.
I hope I explained myself well.