Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a MaraDNS server and need to log all the IP's of DNS servers which query it. With logging verbosity turned up, it outputs this to stdout, but when I try to redirect stdout (and stderr) to a log file, it does'nt seem to capture it in real time and misses some of the output when writing to stdout. Any ideas?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

If you're have a high query rate to your DNS server, it's possible that the storage medium you're using to store your logs is not sufficiently fast enough to keep up with your STDIO buffers. If, in the amount of time it takes to receive 100 queries, your disks are only fast enough that 90 queries can be written, then you're going to start dropping entries. Either they won't make it into your STDIO buffers at all, or you'll lose queued messages from the buffer.

If this is the case, and you have access to high performance storage, like an SSD, try putting your log on the SSD. If you don't have an SSD, you could try a compromise. Like any compromise, you do risk losing data, though.

Create a RAM based filesystem, and write your logs there. Have another job that periodically syncs or copies those logs to slower storage. You'll lose data if your server crashes, or reboots (possibly), but while things are running normally, you'll have a better chance of catching all those queries.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.