Skip to content

Commit

Permalink
syslog logging of kitodo active mq client
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Apr 1, 2022
1 parent 4e1874f commit 15d127e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM ocrd/core:latest

MAINTAINER [email protected]

ARG KITODO_MQ_CLIENT_VERSION=0.1
ARG KITODO_MQ_CLIENT_VERSION=0.2

ENV HOME=/

Expand All @@ -26,9 +26,13 @@ RUN apt-get update && \
# configure writing to ocrd.log for profiling
COPY ocrd_logging.conf /etc

# add activemq log4j properties
COPY kitodo-activemq-client-log4j2.properties /opt/kitodo-activemq-client/log4j2.properties
ENV ACTIVEMQ_CLIENT_LOG4J2 /opt/kitodo-activemq-client/log4j2.properties

# add ActiveMQ client library
ADD https://github.com/markusweigelt/kitodo-activemq-client/releases/download/${KITODO_MQ_CLIENT_VERSION}/kitodo-activemq-client-${KITODO_MQ_CLIENT_VERSION}.jar /opt
ENV ACTIVEMQ_CLIENT /opt/kitodo-activemq-client-${KITODO_MQ_CLIENT_VERSION}.jar
ADD https://github.com/markusweigelt/kitodo-activemq-client/releases/download/${KITODO_MQ_CLIENT_VERSION}/kitodo-activemq-client-${KITODO_MQ_CLIENT_VERSION}.jar /opt/kitodo-activemq-client
ENV ACTIVEMQ_CLIENT /opt/kitodo-activemq-client/kitodo-activemq-client-${KITODO_MQ_CLIENT_VERSION}.jar
RUN chmod go+r $ACTIVEMQ_CLIENT

# run OpenSSH server
Expand Down
2 changes: 1 addition & 1 deletion for_production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CONTROLLERPORT=${CONTROLLER#*:}
}
# signal SUCCESS via ActiveMQ
if test -n "$ACTIVEMQ" -a -n "$ACTIVEMQ_CLIENT"; then
java -jar "$ACTIVEMQ_CLIENT" "tcp://$ACTIVEMQ?closeAsync=false" "KitodoProduction.FinalizeStep.Queue" $TASK_ID $PROC_ID
java -Dlog4j2.configurationFile=$ACTIVEMQ_CLIENT_LOG4J2 -jar "$ACTIVEMQ_CLIENT" "tcp://$ACTIVEMQ?closeAsync=false" "KitodoProduction.FinalizeStep.Queue" $TASK_ID $PROC_ID
fi
)&

Expand Down
23 changes: 23 additions & 0 deletions kitodo-activemq-client-log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
status = warn
# Name of the configuration
name = KitodoActiveMQClientLog4j2Config

# Console appender configuration
appender.console.type = console
appender.console.name = ConsoleAppender
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

# Syslog appender configuration
appender.syslog.type = Syslog
appender.syslog.name = SyslogAppender
appender.syslog.layout.type = PatternLayout
appender.syslog.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.syslog.host = localhost
appender.syslog.port = 514
appender.syslog.protocol = UDP
appender.syslog.facility = LOCAL0

rootLogger.level = info
rootLogger.appenderRef.stdout.ref = ConsoleAppender
rootLogger.appenderRef.SyslogAppender.ref = SyslogAppender
7 changes: 7 additions & 0 deletions start-sshd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cat /id_rsa >> /.ssh/id_rsa

ssh-keyscan -H ${CONTROLLER%:*} >> /.ssh/known_hosts


# turn off the login banner
touch /.hushlogin

Expand Down Expand Up @@ -31,6 +32,12 @@ echo ocrd:*:19020:0:99999:7::: >> /etc/shadow
#/usr/sbin/sshd -D -e
service ssh start

# Replace imklog to prevent starting problems of rsyslog
/bin/sed -i '/imklog/s/^/#/' /etc/rsyslog.conf

# rsyslog upd reception on port 514
/bin/sed -i '/imudp/s/^#//' /etc/rsyslog.conf

service rsyslog start

sleep 2
Expand Down

0 comments on commit 15d127e

Please sign in to comment.