39

Recently my jenkins.log has started getting very large, very quickly, full of exceptions about DNS resolution. I attempted to use logrotate, but the log file grows too quickly even to be rotated, and just eats up all my disk space, which then causes various services to fail because they cannot write files anymore.

How do I avoid that?

Mohit Kanwar
  • 2,962
  • 7
  • 39
  • 59
Matthieu Wipliez
  • 1,901
  • 1
  • 16
  • 15

6 Answers6

49

You can disable the logging of these DNS errors by adjusting the logging settings within Jenkins.

From the Jenkins web interface go to:

 Manage Jenkins -> System Log -> Log Levels (on the left)

Add the following entry:

Name: javax.jmdns

Level: off

This way you can keep the Multicast DNS feature but without all the logging data.

Neil P
  • 678
  • 8
  • 7
  • 1
    Any idea how to keep this set when you update Jenkins? – Siecje Aug 04 '16 at 20:38
  • @Siecje you could try using a "logging.properties" file to configure the logging, as is done in this answer: http://stackoverflow.com/a/6307666/2286664 – Neil P Sep 12 '16 at 16:49
24

This seems to be due to DNS multicast as explained here: https://issues.jenkins-ci.org/browse/JENKINS-25369

Workaround: add -Dhudson.DNSMultiCast.disabled=true to JAVA_ARGS.

PS: I'm answering my own question here on Stack Overflow because I couldn't find the answer on Google easily, and it will be useful to other people running Jenkins.

Matthieu Wipliez
  • 1,901
  • 1
  • 16
  • 15
  • 1
    You don't need to justify answering your own question - [it's encouraged](https://stackoverflow.com/help/self-answer) – Robin Winslow Feb 20 '18 at 23:01
5

Modify JAVA_ARGS in /etc/default/jenkins (location for Debian / Ubuntu installations at least) to disable DNS multicast feature.

Change this: JAVA_ARGS="-Djava.awt.headless=true"

To this: JAVA_ARGS="-Djava.awt.headless=true -Dhudson.DNSMultiCast.disabled=true"

And restart the service service jenkins restart

Mikko
  • 1,877
  • 1
  • 25
  • 37
3

You can plug in on Jenkins initialization with init.groovy file in Jenkins home folder and change the logging levels permanently with it. The changes will be kept even if Jenkins is restarted. There is a simple content of the file:

import java.util.logging.Level
import java.util.logging.Logger

Logger.getLogger("").setLevel(Level.SEVERE)
Logger.getLogger("org.apache.sshd").setLevel(Level.SEVERE)
Logger.getLogger("winstone").setLevel(Level.SEVERE)

You can change the name of the logger and the level so that it suits your needs. See my article on this topic for more details.

K. B.
  • 3,342
  • 3
  • 19
  • 32
0

For the ones using Centos/Redhat, the option to disable the DNS Multicast feature can found in /etc/sysconfig/jenkins

JENKINS_JAVA_OPTIONS="-Dhudson.DNSMultiCast.disabled=true -Dhudson.udp=-1 -Djava.awt.headless=true"
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
git2goo
  • 1
  • 1
0

In my case I received the log entry whenever a Sign in attempt was rejected via the user interface.

User authentication is done via LDAP and the provided user/password tuple is correct. After a while the sign in attempt is working.

Is it possible that the user is rejected because of the enabled DNS Multi cast feature?

Ali Avcı
  • 870
  • 5
  • 8