Is it acceptable to ask an unknown professor outside my dept for help in a related field during his office hours?
In general, yes. Personally I've been pretty open to answering questions about my field of expertise from "random" students during my office hours. But:


Ask first: "I was working on X and am wondering about Y. Do you think you would have time to answer a few questions?" Be prepared to hear "No, I'm sorry, I don't."
Ask the right person. Don't assume that a CS professor who teaches machine learning will know anything about Apache logs.
Come prepared with a specific question - don't expect me to explain an entire topic to you from beginning to end, or spend an hour walking you through a tutorial on some programming concept you want to learn.
Don't abuse office hours as a substitute for doing basic research on your own (e.g. "I know I could easily find the answer to my question online, but it was quicker to come ask you during office hours.")  
Professors may want to give "priority" to students who are actually enrolled in their classes. If the office hours are busy, try not to monopolize the professor's time - or come back at a less busy time, like the week after the midterm exam instead of the week before ;)