When visiting a museum in Malmo my friends and I came across this little guy. While we observed him wandering around his tank he suddenly opened a channel on the side of his head and shot some red string out of it. The string seemed kind of sticky, nothing like ink. We are still wondering what it was and why he was doing it. Maybe some kind of defensive behaviour or just usual octopus stuff?
Just a guess, but could the octopus have been pooping?
This is a gif of an octopus pooping. It matches your description except for the colour, so I'm not quite sure. Did it look like this? Also, could the substance look red because of the tank lights? After all, your photo looks weirdly violet overall.
Fun fact: octopuses have their anus channeled in the siphon (the "channel on the side of his head" you observed) and this has been object of a question here in Bio.SE.