Skip to content

Commit

Permalink
SVCPLAN-6652: Add syslog class to track specific GitLab logs via syslog
Browse files Browse the repository at this point in the history
  • Loading branch information
billglick committed Dec 2, 2024
1 parent 0491ec8 commit 029ffc1
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
13 changes: 13 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [`profile_gitlab::backup`](#profile_gitlab--backup): Configure GitLab backups
* [`profile_gitlab::firewall`](#profile_gitlab--firewall): Open GitLab ports in the firewall
* [`profile_gitlab::ssh`](#profile_gitlab--ssh): Configure ssh access to GitLab for git clients
* [`profile_gitlab::syslog`](#profile_gitlab--syslog): Configure syslog related to GitLab

## Classes

Expand Down Expand Up @@ -118,3 +119,15 @@ Data type: `Array[String]`

List of subnets allowed SSH access

### <a name="profile_gitlab--syslog"></a>`profile_gitlab::syslog`

Configure syslog related to GitLab

#### Examples

#####

```puppet
include profile_gitlab::syslog
```

1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
include profile_gitlab::backup
include profile_gitlab::firewall
include profile_gitlab::ssh
include profile_gitlab::syslog
}
43 changes: 43 additions & 0 deletions manifests/syslog.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# @summary Configure syslog related to GitLab
#
# @example
# include profile_gitlab::syslog
class profile_gitlab::syslog {
include rsyslog

$rsyslog_default_params = {
target => '75_gitlab.conf',
confdir => $rsyslog::confdir,
}

# Define the rsyslog module
rsyslog::component::module { 'imfile':
priority => $rsyslog::module_load_priority,
* => $rsyslog_default_params,
}

# Define the rsyslog inputs
rsyslog::component::input { 'gitlab-access':
config => {
facility => 'local0',
file => '/var/log/gitlab/nginx/gitlab_access.log',
severity => 'info',
tag => 'gitlab-access',
},
priority => $rsyslog::input_priority,
type => 'imfile',
* => $rsyslog_default_params,
}

rsyslog::component::input { 'gitlab-shell':
config => {
facility => 'local0',
file => '/var/log/gitlab/gitlab-shell/gitlab-shell.log',
severity => 'info',
tag => 'gitlab-shell',
},
priority => $rsyslog::input_priority,
type => 'imfile',
* => $rsyslog_default_params,
}
}
13 changes: 13 additions & 0 deletions spec/classes/syslog_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'profile_gitlab::syslog' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile.with_all_deps }
end
end
end

0 comments on commit 029ffc1

Please sign in to comment.