Prefix docker container name to syslog syslogtag (program name) (#1810)
This commit is contained in:
parent
3d24305253
commit
7ba08e5bf6
@ -29,8 +29,10 @@ $ModLoad imuxsock # provides support for local system logging
|
|||||||
###########################
|
###########################
|
||||||
#### GLOBAL DIRECTIVES ####
|
#### GLOBAL DIRECTIVES ####
|
||||||
###########################
|
###########################
|
||||||
#Set remote syslog server
|
|
||||||
*.* @127.0.0.1:514
|
# Set remote syslog server
|
||||||
|
template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%")
|
||||||
|
*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Use traditional timestamp format.
|
# Use traditional timestamp format.
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Make apt-get non-interactive
|
# Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
# Enable -O for all Python calls
|
# Enable -O for all Python calls
|
||||||
ENV PYTHONOPTIMIZE 1
|
ENV PYTHONOPTIMIZE 1
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
@ -76,4 +79,4 @@ COPY ["files/arp_update", "/usr/bin"]
|
|||||||
RUN echo "docker-sonic-p4" > /etc/hostname
|
RUN echo "docker-sonic-p4" > /etc/hostname
|
||||||
RUN touch /etc/quagga/zebra.conf
|
RUN touch /etc/quagga/zebra.conf
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
FROM docker-config-engine
|
FROM docker-config-engine
|
||||||
|
|
||||||
|
ARG docker_container_name
|
||||||
|
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name\/%syslogtag%/;" /etc/rsyslog.conf
|
||||||
|
|
||||||
## Make apt-get non-interactive
|
## Make apt-get non-interactive
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
2
slave.mk
2
slave.mk
@ -382,6 +382,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g
|
|||||||
--build-arg user=$(USER) \
|
--build-arg user=$(USER) \
|
||||||
--build-arg uid=$(UID) \
|
--build-arg uid=$(UID) \
|
||||||
--build-arg guid=$(GUID) \
|
--build-arg guid=$(GUID) \
|
||||||
|
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
|
||||||
-t $* $($*.gz_PATH) $(LOG)
|
-t $* $($*.gz_PATH) $(LOG)
|
||||||
docker save $* | gzip -c > $@
|
docker save $* | gzip -c > $@
|
||||||
# Clean up
|
# Clean up
|
||||||
@ -412,6 +413,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
|
|||||||
--build-arg user=$(USER) \
|
--build-arg user=$(USER) \
|
||||||
--build-arg uid=$(UID) \
|
--build-arg uid=$(UID) \
|
||||||
--build-arg guid=$(GUID) \
|
--build-arg guid=$(GUID) \
|
||||||
|
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
|
||||||
-t $* $($*.gz_PATH) $(LOG)
|
-t $* $($*.gz_PATH) $(LOG)
|
||||||
docker save $* | gzip -c > $@
|
docker save $* | gzip -c > $@
|
||||||
# Clean up
|
# Clean up
|
||||||
|
Loading…
Reference in New Issue
Block a user