init syslog-ng

This commit is contained in:
Kameron Kenny 2024-06-07 12:11:50 -04:00
commit 3e555d50db
No known key found for this signature in database
GPG Key ID: E5006629839D2276
4 changed files with 114 additions and 0 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM lscr.io/linuxserver/syslog-ng:latest
LABEL version="20240607.1.1"
LABEL description="syslog-ng"
RUN mkdir -p /config
COPY config /config

48
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,48 @@
pipeline {
agent {
label 'pi501.in.thelinuxpro.net'
}
stages {
stage("verify tooling") {
steps {
sh '''
docker version
docker info
docker compose version
'''
}
}
stage("Build Containers and push to registry") {
steps {
script {
sh 'docker compose build --push'
}
}
}
stage('Create contexts') {
steps {
sh 'docker context ls | grep pi502 || docker context create pi502 --docker "host=ssh://pi502.in.thelinuxpro.net"'
}
}
stage('Start container') {
steps {
script {
def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
if (status_s != 0) {
sh 'docker --context pi502 compose up -d'
sh 'docker --context pi502 compose ps'
} else {
echo 'skip'
}
}
}
}
}
}

30
config/syslog-ng.conf Normal file
View File

@ -0,0 +1,30 @@
#############################################################################
# Default syslog-ng.conf file which collects all local logs into a
# single file called /var/log/messages tailored to container usage.
@version: 4.7
@include "scl.conf"
source s_local {
internal();
};
source s_network_tcp {
syslog(transport(tcp) port(6601));
};
source s_network_udp {
syslog(transport(udp) port(5514));
};
destination d_local {
file("/var/log/messages");
file("/var/log/messages-kv.log" template("$ISODATE $HOST $(format-welf --scope all-nv-pairs)\n") frac-digits(3));
};
log {
source(s_local);
source(s_network_tcp);
source(s_network_udp);
destination(d_local);
};

29
docker-compose.yml Normal file
View File

@ -0,0 +1,29 @@
networks:
infra_dev_net:
external: true
volumes:
syslog-ng_logs:
driver: local
services:
syslog-ng:
build:
dockerfile: Dockerfile
image: docker-registry1.in.thelinuxpro.net:5000/tlp/syslog-ng:240607.1.1
container_name: syslog-ng
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
volumes:
- syslog-ng_logs:/var/log
ports:
- 514:5514/udp
- 601:6601/tcp
- 6514:6514/tcp
restart: unless-stopped
networks:
infra_dev_net:
ipv4_address: 10.99.23.51