Skip to content

Commit

Permalink
oidcng: Logback should include the json syslog as well
Browse files Browse the repository at this point in the history
  • Loading branch information
quartje committed Jul 16, 2024
1 parent 157d758 commit 966d105
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions roles/oidcng/templates/logback.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,51 @@
</encoder>
</appender>

<appender name="JSON_SYSLOG" class="net.logstash.logback.appender.LogstashSocketAppender">
<host>{{ ansible_fqdn }}</host>
<port>514</port>
<customFields>{"app":"oidcng"}</customFields>
<fieldNames>
<thread>[ignore]</thread>
<version>[ignore]</version>
<levelValue>[ignore]</levelValue>
</fieldNames>
<prefix class="ch.qos.logback.classic.PatternLayout">
<pattern>oidcngjson:</pattern>
</prefix>
</appender>

<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<smtpHost>{{ smtp_server }}</smtpHost>
<from>{{ noreply_email }}</from>
<to>{{ error_mail_to }}</to>
<subject>{{ error_subject_prefix }}Unexpected error oidcng</subject>
<layout class="ch.qos.logback.classic.html.HTMLLayout"/>

<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<filter class="filter.CustomThresholdFilter">
<clazz>com.nimbusds.oauth2.sdk.ParseException</clazz>
<clazz>org.springframework.security.authentication.BadCredentialsException</clazz>
<clazz>oidc.exceptions.UnauthorizedException</clazz>
<clazz>oidc.exceptions.RedirectMismatchException</clazz>
<clazz>org.springframework.dao.EmptyResultDataAccessException</clazz>
<clazz>java.lang.IllegalArgumentException</clazz>
<level>ERROR</level>
</filter>
</appender>

<logger name="dashboard" level="DEBUG" />
<logger name="oidc" level="WARN" />
<logger name="org.springframework" level="WARN" />
<root level="WARN">
<appender-ref ref="STDOUT" />
{%if oidcng_logback_file |bool %}
<appender-ref ref="FILE" />
{%endif%}
{%if oidcng_logback_email |bool %}
<appender-ref ref="EMAIL" />
{%endif%}
<appender-ref ref="SYSLOG" />
{%if oidcng_logback_json |bool %}
<appender-ref ref="JSON_SYSLOG" />
{%endif%}
</root>

</configuration>

0 comments on commit 966d105

Please sign in to comment.