If I'm there with a purpose, other than just enjoying the view, I log it, as I almost certainly learned something from it towards my total experience.
If I can't legally log it as pilot, then I put nothing in the flying hours coumn, or if it's somethign I do a lot (in my case flying as a Flight Test Observer or airborne scientist) then it goes in a separate column so I can keep tabs on total experience, without claiming it to be something it isn't. I don't fly as anybody's safety pilot, but if I did, I'd do that also.
For example, the one time I got a go in a Yak-52, I got to handle it, I learned about the aeroplane, it increased my store of aviation knowledge and experience. So it's in my logbook, take-off and landing times are shown, but no number in the pilot hours column. My logbook is my personal record of aviation experience.
Anybody have a problem with such flights being a line in my logbook - tough, I don't care.
G