The following method does not allow syslog tags to include characters other than alphanumeric characters, for example, underscores are not allowed. The syslog spec allows public void setTag(final String tag) { . . . if (NOT_ALPHANUM.matcher(newTag).find()) { throw new IllegalArgumentException("tag contains non-alphanumeric characters"); } . . . }