Skip to content

Commit 0277205

Browse files
authored
Update and fix documentation (#200)
* Update and fix documentation --------- Signed-off-by: Dan Webb <[email protected]>
1 parent 6437442 commit 0277205

File tree

9 files changed

+164
-108
lines changed

9 files changed

+164
-108
lines changed

Diff for: .github/workflows/ci.yml

+10-11
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,30 @@ jobs:
2323
strategy:
2424
matrix:
2525
os:
26-
- "almalinux-8"
27-
- "amazonlinux-2"
28-
- "centos-7"
29-
- "centos-stream-8"
30-
- "debian-10"
26+
- "almalinux-9"
27+
- "amazonlinux-2023"
28+
- "centos-stream-9"
29+
- "centos-stream-10"
3130
- "debian-11"
32-
- "fedora-latest"
33-
- "opensuse-leap-15"
34-
- "rockylinux-8"
35-
- "ubuntu-1804"
36-
- "ubuntu-2004"
31+
- "debian-12"
32+
# - "opensuse-leap-15"
33+
- "ubuntu-2204"
34+
- "ubuntu-2404"
3735
suite:
3836
- "default"
3937
fail-fast: false
4038

4139
steps:
4240
- name: Check out code
43-
uses: actions/checkout@v4 # v4
41+
uses: actions/checkout@v4
4442
- name: Install Chef
4543
uses: actionshub/[email protected]
4644
- name: Dokken
4745
uses: actionshub/[email protected]
4846
env:
4947
CHEF_LICENSE: accept-no-persist
5048
KITCHEN_LOCAL_YAML: kitchen.dokken.yml
49+
CHEF_VERSION: ${{ vars.CHEF_VERSION }}
5150
with:
5251
suite: ${{ matrix.suite }}
5352
os: ${{ matrix.os }}

Diff for: .rubocop.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require:
2+
- cookstyle

Diff for: CHANGELOG.md

+48-41
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,54 @@ This file is used to list changes made in each version of the logrotate cookbook
88

99
Standardise files with files in sous-chefs/repo-management
1010

11-
Standardise files with files in sous-chefs/repo-management
12-
1311
## 3.0.26 - *2024-07-15*
1412

1513
Standardise files with files in sous-chefs/repo-management
1614

17-
Standardise files with files in sous-chefs/repo-management
18-
19-
Standardise files with files in sous-chefs/repo-management
20-
2115
## 3.0.25 - *2024-05-06*
2216

17+
No notable changes
18+
2319
## 3.0.24 - *2024-05-06*
2420

21+
No notable changes
22+
2523
## 3.0.23 - *2023-09-28*
2624

25+
No notable changes
26+
2727
## 3.0.22 - *2023-09-04*
2828

29+
No notable changes
30+
2931
## 3.0.21 - *2023-07-10*
3032

33+
No notable changes
34+
3135
## 3.0.20 - *2023-05-17*
3236

37+
No notable changes
38+
3339
## 3.0.19 - *2023-04-07*
3440

3541
Standardise files with files in sous-chefs/repo-management
3642

3743
## 3.0.18 - *2023-04-01*
3844

45+
No notable changes
46+
3947
## 3.0.17 - *2023-04-01*
4048

41-
## 3.0.16 - *2023-04-01*
49+
No notable changes
4250

43-
Standardise files with files in sous-chefs/repo-management
51+
## 3.0.16 - *2023-04-01*
4452

4553
Standardise files with files in sous-chefs/repo-management
4654

4755
## 3.0.15 - *2023-03-02*
4856

57+
No notable changes
58+
4959
## 3.0.14 - *2023-02-27*
5060

5161
Standardise files with files in sous-chefs/repo-management
@@ -64,39 +74,37 @@ Standardise files with files in sous-chefs/repo-management
6474

6575
Standardise files with files in sous-chefs/repo-management
6676

67-
Standardise files with files in sous-chefs/repo-management
68-
6977
## 3.0.9 - *2022-02-17*
7078

71-
- Standardise files with files in sous-chefs/repo-management
79+
Standardise files with files in sous-chefs/repo-management
7280

7381
## 3.0.8 - *2022-02-08*
7482

75-
- Remove delivery folder
83+
Remove delivery folder
7684

7785
## 3.0.7 - *2022-02-01*
7886

79-
- Update tested platforms
87+
Update tested platforms
8088

8189
## 3.0.6 - *2022-01-14*
8290

83-
- Do not sort options as the order can be important
91+
Do not sort options as the order can be important
8492

8593
## 3.0.5 - *2021-11-03*
8694

87-
- Add CentOS Stream 8 to CI pipeline
95+
Add CentOS Stream 8 to CI pipeline
8896

8997
## 3.0.4 - *2021-08-30*
9098

91-
- Standardise files with files in sous-chefs/repo-management
99+
Standardise files with files in sous-chefs/repo-management
92100

93101
## 3.0.3 - *2021-06-01*
94102

95-
- Standardise files with files in sous-chefs/repo-management
103+
Standardise files with files in sous-chefs/repo-management
96104

97105
## 3.0.2 - *2021-05-12*
98106

99-
- Fix passing options to global path declarations
107+
Fix passing options to global path declarations
100108

101109
## 3.0.1 - *2021-05-12*
102110

@@ -218,46 +226,45 @@ Standardise files with files in sous-chefs/repo-management
218226
- Fix missing end tag in template
219227
- Don't re-initialize constants.
220228
- Fix rubocop finding
221-
- [COOK-3911] Allow to use maxsize parameter.
222-
- [COOK-4000] Allow to use dateyesterday option.
223-
- [COOK-4024] Allow to use su parameter.
224-
- [COOK-4175] Allows use of the dateformat parameter.
229+
- Allow to use maxsize parameter.
230+
- Allow to use dateyesterday option.
231+
- Allow to use su parameter.
232+
- Allows use of the dateformat parameter.
225233
- Loosen test-kitchen version constraint
226234
- Add rvm files to gitignore
227235

228236
## 1.4.0
229237

230-
- **[COOK-3632](https://tickets.chef.io/browse/COOK-3632)** - Raise Exception when adding more than one invalid option
231-
- **[COOK-3141](https://tickets.chef.io/browse/COOK-3141)** - Do not duplicate template entires for multiple paths
232-
- **[COOK-3034](https://tickets.chef.io/browse/COOK-3034)** - Update logrotate_app params to accept arrays and strings
233-
- **[COOK-2646](https://tickets.chef.io/browse/COOK-2646)** - Add ability to choose file mode for logrotate template
238+
- Raise Exception when adding more than one invalid option
239+
- Do not duplicate template entires for multiple paths
240+
- Update logrotate_app params to accept arrays and strings
241+
- Add ability to choose file mode for logrotate template
234242

235243
## 1.3.0
236244

237-
- **[COOK-3341](https://tickets.chef.io/browse/COOK-3341)** - Add optional `frequency` and `rotate` params when defined globally
238-
- **[COOK-3298](https://tickets.chef.io/browse/COOK-3298)** - Use `Array` instead of `respond_to?(:each)`
239-
- **[COOK-3285](https://tickets.chef.io/browse/COOK-3285)** - Change `logrotate.d` config file mode to `0644`
240-
- **[COOK-3250](https://tickets.chef.io/browse/COOK-3250)** - Add `minsize`
241-
- **[COOK-3274](https://tickets.chef.io/browse/COOK-3274)** - Fix README typo that suggested the opposite action
242-
243-
- **[COOK-2923](https://tickets.chef.io/browse/COOK-2923)** - Add `olddir` option
244-
- **[COOK-1651](https://tickets.chef.io/browse/COOK-1651)** - Add `dateext` ability
245+
- Add optional `frequency` and `rotate` params when defined globally
246+
- Use `Array` instead of `respond_to?(:each)`
247+
- Change `logrotate.d` config file mode to `0644`
248+
- Add `minsize`
249+
- Fix README typo that suggested the opposite action
250+
- Add `olddir` option
251+
- Add `dateext` ability
245252

246253
## 1.2.2
247254

248-
- [COOK-2872]: Add firstaction/lastaction ability to logrotate
249-
- [COOK-2908]: Argument error in `logrotate_app` definition
255+
- Add firstaction/lastaction ability to logrotate
256+
- Argument error in `logrotate_app` definition
250257

251258
## 1.2.0
252259

253-
- [COOK-2401] - Add the ability to manage the global logrotate configuration
260+
- Add the ability to manage the global logrotate configuration
254261

255262
## 1.1.0
256263

257-
- [COOK-2218] - Logrotate size parameter
264+
- Logrotate size parameter
258265

259266
## 1.0.2
260267

261-
- [COOK-1027] - Add support for pre-/post-rotate commands
262-
- [COOK-1338] - Update log rotate for more flexibility of rotate options
263-
- [COOK-1598] - "Create" isn't a mandatory option
268+
- Add support for pre-/post-rotate commands
269+
- Update log rotate for more flexibility of rotate options
270+
- "Create" isn't a mandatory option

Diff for: README.md

+38-19
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)
77
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
88

9-
Manages the logrotate package and provides a resource to manage application specific logrotate configuration.
9+
Manages the logrotate package and provides resources to manage both global and application-specific logrotate configurations. This cookbook allows you to manage the logrotate package installation and create configuration for both the main logrotate.conf file and application-specific configurations in /etc/logrotate.d/.
1010

1111
## Maintainers
1212

@@ -27,49 +27,68 @@ Tested on:
2727

2828
### Chef
2929

30-
- Chef 12.5+
30+
- Chef 15.3+
3131

3232
## Resources
3333

34-
- [logrotate_app](documentation/logrotate_app.md)
35-
- [logrotate_global](documentation/logrotate_global.md)
36-
- [logrotate_package](documentation/logrotate_package.md)
34+
- [logrotate_app](documentation/logrotate_app.md) - Manages application-specific logrotate configurations
35+
- [logrotate_global](documentation/logrotate_global.md) - Manages the global logrotate configuration
36+
- [logrotate_package](documentation/logrotate_package.md) - Manages the logrotate package installation
3737

3838
## Usage
3939

40-
The package resource will ensure logrotate is always up to date by default.
40+
### Package Installation
4141

42-
To create application specific logrotate configs, use the `logrotate_app` resource. For example, to rotate logs for a tomcat application named myapp that writes its log file to `/var/log/tomcat/myapp.log`:
42+
By default, the cookbook will install the logrotate package:
4343

4444
```ruby
45-
logrotate_app 'tomcat-myapp' do
46-
path '/var/log/tomcat/myapp.log'
47-
frequency 'daily'
48-
rotate 30
49-
create '644 root adm'
45+
logrotate_package 'logrotate'
46+
```
47+
48+
### Global Configuration
49+
50+
To manage the global logrotate configuration:
51+
52+
```ruby
53+
logrotate_global 'logrotate' do
54+
options %w(weekly dateext)
55+
parameters(
56+
'rotate' => 4,
57+
'create' => nil
58+
)
59+
paths(
60+
'/var/log/wtmp' => {
61+
'missingok' => true,
62+
'monthly' => true,
63+
'create' => '0664 root utmp',
64+
'rotate' => 1
65+
}
66+
)
5067
end
5168
```
5269

53-
To rotate multiple logfile paths, specify the path as an array:
70+
### Application-Specific Configuration
71+
72+
To create application-specific logrotate configs, use the `logrotate_app` resource:
5473

5574
```ruby
5675
logrotate_app 'tomcat-myapp' do
57-
path ['/var/log/tomcat/myapp.log', '/opt/local/tomcat/catalina.out']
76+
path '/var/log/tomcat/myapp.log'
5877
frequency 'daily'
78+
rotate 30
5979
create '644 root adm'
60-
rotate 7
80+
options %w(missingok compress delaycompress copytruncate notifempty)
6181
end
6282
```
6383

64-
To specify which logrotate options, specify the options as an array:
84+
For multiple log files:
6585

6686
```ruby
6787
logrotate_app 'tomcat-myapp' do
68-
path '/var/log/tomcat/myapp.log'
69-
options ['missingok', 'delaycompress', 'notifempty']
88+
path ['/var/log/tomcat/myapp.log', '/opt/local/tomcat/catalina.out']
7089
frequency 'daily'
71-
rotate 30
7290
create '644 root adm'
91+
rotate 7
7392
end
7493
```
7594

Diff for: documentation/logrotate_app.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ The resource takes the following properties:
1111
| Name | Type | Default | Description |
1212
| ---------------- | ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
1313
| `path` | String, Array | `nil` | Specifies a single path (string) or multiple paths (array) that should have logrotation stanzas created in the config file. |
14-
| `cookbook` | String | `logrotate` | The cookbook that continues the template for logrotate_app config resources. |
15-
| `template_name` | String | `logrotate` | Sets the template source. |
16-
| `template_mode` | String | `logrotate` | The mode to create the logrotate template. |
17-
| `template_owner` | String | `logrotate` | The owner of the logrotate template. |
18-
| `template_group` | String | `logrotate` | The group of the logrotate template. |
19-
| `frequency` | String | `logrotate` | Sets the frequency for rotation. Valid values are: hourly, daily, weekly, monthly, yearly, see the logrotate man page for more information. |
20-
| `options` | String | `logrotate` | Any logrotate configuration option that doesn't specify a value. See the logrotate(8) manual page of v3.9.2 or earlier for details. |
14+
| `cookbook` | String | `node['root_group']` | The cookbook that continues the template for logrotate_app config resources. |
15+
| `template_name` | String | `logrotate.erb` | Sets the template source. |
16+
| `template_mode` | String | `0644` | The mode to create the logrotate template. |
17+
| `template_owner` | String | `root` | The owner of the logrotate template. |
18+
| `template_group` | String | `root` | The group of the logrotate template. |
19+
| `frequency` | String | `weekly` | Sets the frequency for rotation. Valid values are: hourly, daily, weekly, monthly, yearly, see the logrotate man page for more information. |
20+
| `options` | String, Array | `%w(missingok compress delaycompress copytruncate notifempty)` | Any logrotate configuration option that doesn't specify a value. See the logrotate(8) manual page of v3.9.2 or earlier for details. |
21+
| `base_dir` | String | `/etc/logrotate.d` | The base directory where the logrotate configuration files will be stored. |
22+
| `firstaction` | String, Array | `nil` | Script to run before log files are rotated |
23+
| `prerotate` | String, Array | `nil` | Script to run before individual log file is rotated |
24+
| `postrotate` | String, Array | `nil` | Script to run after individual log file is rotated |
25+
| `lastaction` | String, Array | `nil` | Script to run after all log files are rotated |
2126

2227
## Examples
2328

Diff for: documentation/logrotate_global.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22

33
[Back to resource list](../README.md#resources)
44

5-
This resource can be used to drop off customized logrotate config files on a per application basis.
5+
This resource can be used to manage the global logrotate configuration file.
66

77
The resource takes the following properties:
88

99
## Properties
1010

1111
| Name | Type | Default | Description |
1212
| ---------------- | ------------- | ----------------------- | --------------------------------------------------------------- |
13-
| `config_file` | String, | `'/etc/logrotate.conf'` | Specifies the path to the logrotate global config file. |
13+
| `config_file` | String | `'/etc/logrotate.conf'` | Specifies the path to the logrotate global config file. |
1414
| `template_name` | String | `logrotate-global.erb` | Sets the template source. |
15-
| `template_mode` | String | `logrotate` | The mode to create the logrotate config file template. |
16-
| `template_owner` | String | `logrotate` | The owner of the logrotate config file template. |
17-
| `template_group` | String | `logrotate` | The group of the logrotate config file template. |
18-
| `options` | String, Array | `['weekly', 'datext']` | Logrotate global options. |
15+
| `template_mode` | String | `0644` | The mode to create the logrotate config file template. |
16+
| `template_owner` | String | `root` | The owner of the logrotate config file template. |
17+
| `template_group` | String | `node['root_group']` | The group of the logrotate config file template. |
18+
| `cookbook` | String | `logrotate` | The cookbook that contains the template source. |
19+
| `options` | String, Array | `%w(weekly dateext)` | Logrotate global options. |
1920
| `includes` | String, Array | `[]` | Files or directories to include in the logrotate configuration. |
20-
| `parameters` | Hash | `{}` | Logrotate global parameters. |
21-
| `path` | Hash | `{}` | Logrotate global path definitions. |
22-
| `scripts` | Hash | `{}` | Logrotate global options. |
21+
| `parameters` | Hash | `{ 'rotate' => 4, 'create' => nil }` | Logrotate global parameters. |
22+
| `paths` | Hash | `{}` | Logrotate global path definitions. |
23+
| `scripts` | Hash | `{}` | Global scripts to run (firstaction, prerotate, postrotate, lastaction). |
2324

2425
## Examples
2526

0 commit comments

Comments
 (0)