from-scratch 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -1
  3. data/Berksfile.lock +20 -1
  4. data/cookbooks/bluepill/CHANGELOG.md +93 -0
  5. data/cookbooks/bluepill/README.md +91 -0
  6. data/cookbooks/bluepill/attributes/default.rb +44 -0
  7. data/cookbooks/bluepill/metadata.json +1 -0
  8. data/cookbooks/bluepill/providers/service.rb +172 -0
  9. data/cookbooks/bluepill/recipes/default.rb +48 -0
  10. data/cookbooks/bluepill/recipes/rsyslog.rb +28 -0
  11. data/cookbooks/bluepill/resources/service.rb +27 -0
  12. data/cookbooks/bluepill/templates/default/bluepill_init.fedora.erb +34 -0
  13. data/cookbooks/bluepill/templates/default/bluepill_init.freebsd.erb +32 -0
  14. data/cookbooks/bluepill/templates/default/bluepill_init.lsb.erb +37 -0
  15. data/cookbooks/bluepill/templates/default/bluepill_init.rhel.erb +34 -0
  16. data/cookbooks/bluepill/templates/default/bluepill_rsyslog.conf.erb +1 -0
  17. data/cookbooks/nginx/CHANGELOG.md +435 -0
  18. data/cookbooks/nginx/README.md +521 -0
  19. data/cookbooks/nginx/attributes/auth_request.rb +23 -0
  20. data/cookbooks/nginx/attributes/default.rb +131 -0
  21. data/cookbooks/nginx/attributes/devel.rb +24 -0
  22. data/cookbooks/nginx/attributes/echo.rb +24 -0
  23. data/cookbooks/nginx/attributes/geoip.rb +31 -0
  24. data/cookbooks/nginx/attributes/headers_more.rb +24 -0
  25. data/cookbooks/nginx/attributes/lua.rb +28 -0
  26. data/cookbooks/nginx/attributes/naxsi.rb +24 -0
  27. data/cookbooks/nginx/attributes/openssl_source.rb +23 -0
  28. data/cookbooks/nginx/attributes/pagespeed.rb +9 -0
  29. data/cookbooks/nginx/attributes/passenger.rb +58 -0
  30. data/cookbooks/nginx/attributes/rate_limiting.rb +23 -0
  31. data/cookbooks/nginx/attributes/repo.rb +35 -0
  32. data/cookbooks/nginx/attributes/set_misc.rb +8 -0
  33. data/cookbooks/nginx/attributes/socketproxy.rb +13 -0
  34. data/cookbooks/nginx/attributes/source.rb +42 -0
  35. data/cookbooks/nginx/attributes/status.rb +22 -0
  36. data/cookbooks/nginx/attributes/syslog.rb +24 -0
  37. data/cookbooks/nginx/attributes/upload_progress.rb +26 -0
  38. data/cookbooks/nginx/definitions/nginx_site.rb +50 -0
  39. data/cookbooks/nginx/files/default/mime.types +78 -0
  40. data/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
  41. data/cookbooks/nginx/libraries/matchers.rb +20 -0
  42. data/cookbooks/nginx/metadata.json +351 -0
  43. data/cookbooks/nginx/recipes/authorized_ips.rb +32 -0
  44. data/cookbooks/nginx/recipes/commons.rb +24 -0
  45. data/cookbooks/nginx/recipes/commons_conf.rb +42 -0
  46. data/cookbooks/nginx/recipes/commons_dir.rb +57 -0
  47. data/cookbooks/nginx/recipes/commons_script.rb +29 -0
  48. data/cookbooks/nginx/recipes/default.rb +31 -0
  49. data/cookbooks/nginx/recipes/headers_more_module.rb +50 -0
  50. data/cookbooks/nginx/recipes/http_auth_request_module.rb +52 -0
  51. data/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
  52. data/cookbooks/nginx/recipes/http_geoip_module.rb +113 -0
  53. data/cookbooks/nginx/recipes/http_gzip_static_module.rb +30 -0
  54. data/cookbooks/nginx/recipes/http_mp4_module.rb +2 -0
  55. data/cookbooks/nginx/recipes/http_perl_module.rb +23 -0
  56. data/cookbooks/nginx/recipes/http_realip_module.rb +38 -0
  57. data/cookbooks/nginx/recipes/http_spdy_module.rb +23 -0
  58. data/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
  59. data/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
  60. data/cookbooks/nginx/recipes/ipv6.rb +23 -0
  61. data/cookbooks/nginx/recipes/lua.rb +47 -0
  62. data/cookbooks/nginx/recipes/naxsi_module.rb +52 -0
  63. data/cookbooks/nginx/recipes/ngx_devel_module.rb +44 -0
  64. data/cookbooks/nginx/recipes/ngx_lua_module.rb +47 -0
  65. data/cookbooks/nginx/recipes/ohai_plugin.rb +35 -0
  66. data/cookbooks/nginx/recipes/openssl_source.rb +45 -0
  67. data/cookbooks/nginx/recipes/package.rb +52 -0
  68. data/cookbooks/nginx/recipes/pagespeed_module.rb +62 -0
  69. data/cookbooks/nginx/recipes/passenger.rb +56 -0
  70. data/cookbooks/nginx/recipes/repo.rb +41 -0
  71. data/cookbooks/nginx/recipes/repo_passenger.rb +39 -0
  72. data/cookbooks/nginx/recipes/set_misc.rb +30 -0
  73. data/cookbooks/nginx/recipes/socketproxy.rb +26 -0
  74. data/cookbooks/nginx/recipes/source.rb +205 -0
  75. data/cookbooks/nginx/recipes/syslog_module.rb +69 -0
  76. data/cookbooks/nginx/recipes/upload_progress_module.rb +53 -0
  77. data/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
  78. data/cookbooks/nginx/templates/default/default-site.erb +11 -0
  79. data/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
  80. data/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
  81. data/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb +1 -0
  82. data/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +7 -0
  83. data/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
  84. data/cookbooks/nginx/templates/default/modules/passenger.conf.erb +13 -0
  85. data/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb +89 -0
  86. data/cookbooks/nginx/templates/default/modules/upload_progress.erb +4 -0
  87. data/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +39 -0
  88. data/cookbooks/nginx/templates/default/nginx.conf.erb +103 -0
  89. data/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
  90. data/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
  91. data/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  92. data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  93. data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  94. data/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
  95. data/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  96. data/cookbooks/nginx/templates/default/sv-nginx-run.erb +4 -0
  97. data/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
  98. data/cookbooks/nginx/templates/suse/nginx.init.erb +115 -0
  99. data/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
  100. data/cookbooks/ohai/CHANGELOG.md +69 -0
  101. data/cookbooks/ohai/README.md +89 -0
  102. data/cookbooks/ohai/attributes/default.rb +31 -0
  103. data/cookbooks/ohai/files/default/plugins/README +1 -0
  104. data/cookbooks/ohai/libraries/matchers.rb +14 -0
  105. data/cookbooks/ohai/metadata.json +1 -0
  106. data/cookbooks/ohai/providers/hint.rb +38 -0
  107. data/cookbooks/ohai/recipes/default.rb +52 -0
  108. data/cookbooks/ohai/resources/hint.rb +5 -0
  109. data/cookbooks/packagecloud/CHANGELOG.md +12 -0
  110. data/cookbooks/packagecloud/README.md +80 -0
  111. data/cookbooks/packagecloud/attributes/default.rb +8 -0
  112. data/cookbooks/packagecloud/libraries/helper.rb +43 -0
  113. data/cookbooks/packagecloud/libraries/matcher.rb +7 -0
  114. data/cookbooks/packagecloud/metadata.json +1 -0
  115. data/cookbooks/packagecloud/providers/repo.rb +212 -0
  116. data/cookbooks/packagecloud/resources/repo.rb +10 -0
  117. data/cookbooks/packagecloud/templates/.kitchen/logs/kitchen.log +29 -0
  118. data/cookbooks/packagecloud/templates/default/apt.erb +2 -0
  119. data/cookbooks/packagecloud/templates/default/yum.erb +15 -0
  120. data/cookbooks/rsyslog/CHANGELOG.md +193 -0
  121. data/cookbooks/rsyslog/README.md +276 -0
  122. data/cookbooks/rsyslog/attributes/default.rb +131 -0
  123. data/cookbooks/rsyslog/libraries/helpers.rb +25 -0
  124. data/cookbooks/rsyslog/metadata.json +1 -0
  125. data/cookbooks/rsyslog/providers/file_input.rb +44 -0
  126. data/cookbooks/rsyslog/recipes/client.rb +87 -0
  127. data/cookbooks/rsyslog/recipes/default.rb +89 -0
  128. data/cookbooks/rsyslog/recipes/server.rb +44 -0
  129. data/cookbooks/rsyslog/resources/file_input.rb +28 -0
  130. data/cookbooks/rsyslog/templates/default/35-server-per-host.conf.erb +62 -0
  131. data/cookbooks/rsyslog/templates/default/49-relp.conf.erb +10 -0
  132. data/cookbooks/rsyslog/templates/default/49-remote.conf.erb +30 -0
  133. data/cookbooks/rsyslog/templates/default/50-default.conf.erb +6 -0
  134. data/cookbooks/rsyslog/templates/default/file-input.conf.erb +15 -0
  135. data/cookbooks/rsyslog/templates/default/omnios-manifest.xml.erb +30 -0
  136. data/cookbooks/rsyslog/templates/default/rsyslog.conf.erb +117 -0
  137. data/cookbooks/rsyslog/templates/smartos/50-default.conf.erb +18 -0
  138. data/cookbooks/runit/.kitchen.cloud.yml +103 -0
  139. data/cookbooks/runit/.kitchen.yml +38 -0
  140. data/cookbooks/runit/.rspec +3 -0
  141. data/cookbooks/runit/.rubocop.yml +45 -0
  142. data/cookbooks/runit/Berksfile.disabled +11 -0
  143. data/cookbooks/runit/CHANGELOG.md +226 -0
  144. data/cookbooks/runit/CONTRIBUTING.md +266 -0
  145. data/cookbooks/runit/Cheffile +11 -0
  146. data/cookbooks/runit/Gemfile +17 -0
  147. data/cookbooks/runit/LICENSE +201 -0
  148. data/cookbooks/runit/README.md +435 -0
  149. data/cookbooks/runit/Rakefile +23 -0
  150. data/cookbooks/runit/TESTING.md +26 -0
  151. data/cookbooks/runit/attributes/default.rb +62 -0
  152. data/cookbooks/runit/files/default/runit.seed +1 -0
  153. data/cookbooks/runit/files/default/runsvdir +0 -0
  154. data/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  155. data/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  156. data/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  157. data/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  158. data/cookbooks/runit/libraries/default.rb +0 -0
  159. data/cookbooks/runit/libraries/helpers.rb +190 -0
  160. data/cookbooks/runit/libraries/matchers.rb +69 -0
  161. data/cookbooks/runit/libraries/provider_runit_service.rb +326 -0
  162. data/cookbooks/runit/libraries/resource_runit_service.rb +267 -0
  163. data/cookbooks/runit/metadata.json +50 -0
  164. data/cookbooks/runit/recipes/default.rb +91 -0
  165. data/cookbooks/runit/templates/debian/init.d.erb +66 -0
  166. data/cookbooks/runit/templates/default/log-config.erb +24 -0
  167. data/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  168. data/cookbooks/scratchify/Berksfile +2 -1
  169. data/cookbooks/scratchify/Berksfile.lock +20 -1
  170. data/cookbooks/scratchify/lib/from-scratch.rb +1 -4
  171. data/cookbooks/scratchify/lib/from-scratch/version.rb +1 -1
  172. data/cookbooks/scratchify/metadata.json +5 -2
  173. data/cookbooks/scratchify/recipes/default.rb +15 -1
  174. data/cookbooks/scratchify/recipes/nginx_site.rb +4 -0
  175. data/cookbooks/scratchify/recipes/pre_rvm.rb +5 -0
  176. data/cookbooks/scratchify/templates/nginx.erb +31 -0
  177. data/cookbooks/scratchify/templates/node.json.erb +21 -6
  178. data/cookbooks/yum-epel/CHANGELOG.md +84 -0
  179. data/cookbooks/yum-epel/README.md +172 -0
  180. data/cookbooks/yum-epel/attributes/default.rb +1 -0
  181. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +28 -0
  182. data/cookbooks/yum-epel/attributes/epel-source.rb +28 -0
  183. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +28 -0
  184. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +28 -0
  185. data/cookbooks/yum-epel/attributes/epel-testing.rb +28 -0
  186. data/cookbooks/yum-epel/attributes/epel.rb +28 -0
  187. data/cookbooks/yum-epel/metadata.json +1 -0
  188. data/cookbooks/yum-epel/recipes/default.rb +61 -0
  189. data/cookbooks/yum/CHANGELOG.md +294 -0
  190. data/cookbooks/yum/README.md +285 -0
  191. data/cookbooks/yum/attributes/main.rb +100 -0
  192. data/cookbooks/yum/libraries/matchers.rb +27 -0
  193. data/cookbooks/yum/metadata.json +1 -0
  194. data/cookbooks/yum/providers/globalconfig.rb +41 -0
  195. data/cookbooks/yum/providers/repository.rb +106 -0
  196. data/cookbooks/yum/recipes/default.rb +26 -0
  197. data/cookbooks/yum/resources/globalconfig.rb +109 -0
  198. data/cookbooks/yum/resources/repository.rb +69 -0
  199. data/cookbooks/yum/templates/default/main.erb +276 -0
  200. data/cookbooks/yum/templates/default/repo.erb +125 -0
  201. data/lib/from-scratch.rb +1 -0
  202. data/lib/from-scratch/version.rb +1 -1
  203. data/metadata.rb +5 -1
  204. data/recipes/default.rb +15 -1
  205. data/recipes/nginx_site.rb +4 -0
  206. data/recipes/pre_rvm.rb +5 -0
  207. data/templates/nginx.erb +31 -0
  208. data/templates/node.json.erb +21 -6
  209. metadata +194 -1
@@ -0,0 +1,276 @@
1
+ rsyslog Cookbook
2
+ ================
3
+ [![Build Status](https://travis-ci.org/chef-cookbooks/rsyslog.svg?branch=master)](http://travis-ci.org/chef-cookbooks/rsyslog)
4
+ [![Cookbook Version](https://img.shields.io/cookbook/v/rsyslog.svg)](https://supermarket.chef.io/cookbooks/rsyslog)
5
+
6
+ Installs and configures rsyslog to replace sysklogd for client and/or server use. By default, the service will be configured to log to files on local disk. See the Recipes and Examples sections for other uses.
7
+
8
+
9
+ Requirements
10
+ ------------
11
+ #### Platforms
12
+ - Debian/Ubuntu
13
+ - RHEL/CentOS/Scientific/Amazon/Oracle
14
+ - Fedora 20+
15
+ - OmniOS r151006c
16
+
17
+ #### Chef
18
+ - Chef 11+
19
+
20
+ #### Cookbooks
21
+ - none
22
+
23
+ #### Other
24
+ To use the `recipe[rsyslog::client]` recipe, you'll need to set up the `rsyslog.server_search` or `rsyslog.server_ip` attributes. See the __Recipes__ and __Examples__ sections below.
25
+
26
+
27
+ Attributes
28
+ ----------
29
+ See `attributes/default.rb` for default values.
30
+
31
+ * `node['rsyslog']['log_dir']` - If the node is an rsyslog server, this specifies the directory where the logs should be stored.
32
+ * `node['rsyslog']['working_dir']` - The temporary working directory where messages are buffered
33
+ * `node['rsyslog']['server']` - Determined automatically and set to true on the server.
34
+ * `node['rsyslog']['server_ip']` - If not defined then search will be used to determine rsyslog server. Default is `nil`. This can be a string or an array.
35
+ * `node['rsyslog']['server_search']` - Specify the criteria for the server search operation. Default is `role:loghost`.
36
+ * `node['rsyslog']['protocol']` - Specify whether to use `udp` or `tcp` for remote loghost. Default is `tcp`. To use both specify both in a string e.g. 'udptcp'.
37
+ * `node['rsyslog']['bind']` - Specify the address to which the server should be listening; only use with `node['rsyslog']['protocol'] = 'udp'` because the feature does not work with the `tcp` protocol ([more info](http://www.rsyslog.com/doc/master/configuration/modules/imtcp.html#caveats-known-bugs)).
38
+ * `node['rsyslog']['port']` - Specify the port which rsyslog should connect to a remote loghost.
39
+ * `node['rsyslog']['remote_logs']` - Specify whether to send all logs to a remote server (client option). Default is `true`.
40
+ * `node['rsyslog']['per_host_dir']` - "PerHost" directories for template statements in `35-server-per-host.conf`. Default value is the previous cookbook version's value, to preserve compatibility. See __server__ recipe below.
41
+ * `node['rsyslog']['priv_seperation']` - Whether to use privilege separation or not.
42
+ * `node['rsyslog']['priv_user']` - User to run as when using privilege separation. Defult is `node['rsyslog']['user']`
43
+ * `node['rsyslog']['priv_group']` - Group to run as when using privilege separation. Defult is `node['rsyslog']['group']`
44
+ * `node['rsyslog']['max_message_size']` - Specify the maximum allowed message size. Default is 2k.
45
+ * `node['rsyslog']['user']` - Who should own the configuration files and directories
46
+ * `node['rsyslog']['group']` - Who should group-own the configuration files and directories
47
+ * `node['rsyslog']['defaults_file']` - The full path to the defaults/sysconfig file for the service.
48
+ * `node['rsyslog']['service_name']` - The platform-specific name of the service
49
+ * `node['rsyslog']['preserve_fqdn']` - Value of the `$PreserveFQDN` configuration directive in `/etc/rsyslog.conf`. Default is 'off' for compatibility purposes.
50
+ * `node['rsyslog']['high_precision_timestamps']` - Enable high precision timestamps, instead of the "old style" format. Default is 'false'.
51
+ * `node['rsyslog']['repeated_msg_reduction']` - Value of `$RepeatedMsgReduction` configuration directive in `/etc/rsyslog.conf`. Default is 'on'
52
+ * `node['rsyslog']['logs_to_forward']` - Specifies what logs should be sent to the remote rsyslog server. Default is all ( \*.\* ).
53
+ * `node['rsyslog']['default_log_dir']` - log directory used in `50-default.conf` template, defaults to `/var/log`
54
+ * `node['rsyslog']['default_facility_logs']` - Hash containing log facilities and destinations used in `50-default.conf` template.
55
+ * `node['rsyslog']['default_file_template']` - The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for local log files.
56
+ * `node['rsyslog']['default_remote_template']` - The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for sending to remote servers.
57
+ * `node['rsyslog']['rate_limit_interval']` - Value of the $SystemLogRateLimitInterval configuration directive in `/etc/rsyslog.conf`. Default is nil, leaving it to the platform default.
58
+ * `node['rsyslog']['rate_limit_burst']` - Value of the $SystemLogRateLimitBurst configuration directive in `/etc/rsyslog.conf`. Default is nil, leaving it to the platform default.
59
+ * `node['rsyslog']['action_queue_max_disk_space']` - Max amount of disk space the disk-assisted queue is allowed to use ([more info](http://www.rsyslog.com/doc/queues.html)).
60
+ * `node['rsyslog']['enable_tls']` - Whether or not to enable TLS encryption. When enabled, forces protocol to `tcp`. Default is `false`.
61
+ * `node['rsyslog']['tls_ca_file']` - Path to TLS CA file. Required for both server and clients.
62
+ * `node['rsyslog']['tls_certificate_file']` - Path to TLS certificate file. Required for server, optional for clients.
63
+ * `node['rsyslog']['tls_key_file']` - Path to TLS key file. Required for server, optional for clients.
64
+ * `node['rsyslog']['tls_auth_mode']` - Value for `$InputTCPServerStreamDriverAuthMode`/`$ActionSendStreamDriverAuthMode`, determines whether client certs are validated. Defaults to `anon` (no validation).
65
+ * `node['rsyslog']['use_local_ipv4']` - Whether or not to make use the remote local IPv4 address on cloud systems when searching for servers (where available). Default is 'false'.
66
+ * `node['rsyslog']['allow_non_local']` - Whether or not to allow non-local messages. If 'false', incoming messages are only allowed from 127.0.0.1. Default is 'false'.
67
+ * `node['rsyslog']['custom_remote']` - Array of hashes for configuring custom remote server targets
68
+ * `node['rsyslog']['additional_directives']` - Hash of additional directives and their values to place in the main rsyslog config file
69
+
70
+ Recipes
71
+ -------
72
+ ### default
73
+ Installs the rsyslog package, manages the rsyslog service and sets up basic configuration for a standalone machine.
74
+
75
+ ### client
76
+ Includes `recipe[rsyslog]`.
77
+
78
+ Uses `node['rsyslog']['server_ip']` or Chef search (in that precedence order) to determine the remote syslog server's IP address. If search is used, the search query will look for the first `ipaddress` returned from the criteria specified in `node['rsyslog']['server_search']`.
79
+
80
+ You can use `node['rsyslog']['custom_config']` to define custom entries for sending logs to remote servers.
81
+ Available attributes:
82
+ ```
83
+ 'server': Ip/hostname of remote syslog server (Required)
84
+ 'port': Port to send logs to
85
+ 'logs': Syslog log facilities to send (auth, authpriv, daemon, etc)
86
+ 'protocol': Can be tcp or udp
87
+ 'remote_template': Rsyslog template used for the messages
88
+ ```
89
+
90
+ Example:
91
+
92
+ ```ruby
93
+ node['rsyslog']['custom_remote'] = [{ 'server' => '10.10.4.4', 'port' => '567', 'logs' => 'auth.*,mail.*', 'protocol' => 'udp', 'remote_template' => 'RSYSLOG_SyslogProtocol23Format'},
94
+ { 'server' => '10.0.0.3', 'port' => '555', 'logs' => 'authpriv,daemon.*' } ]
95
+ ```
96
+
97
+ The server key is required; if other keys are left out, the default global values will be used (eg `node['rsyslog']['port']` will be used if 'port' is omitted)
98
+
99
+
100
+ If the node itself is a rsyslog server ie it has `rsyslog.server` set to true then the configuration is skipped.
101
+
102
+ If the node had an `/etc/rsyslog.d/35-server-per-host.conf` file previously configured, this file gets removed to prevent duplicate logging.
103
+
104
+ Any previous logs are not cleaned up from the `log_dir`.
105
+
106
+ ### server
107
+ Configures the node to be a rsyslog server. The chosen rsyslog server node should be defined in the `server_ip` attribute or resolvable by the specified search criteria specified in `node['rsyslog']['server_search]` (so that nodes making use of the `client` recipe can find the server to log to).
108
+
109
+ This recipe will create the logs in `node['rsyslog']['log_dir']`, and the configuration is in `/etc/rsyslog.d/server.conf`. This recipe also removes any previous configuration to a remote server by removing the `/etc/rsyslog.d/remote.conf` file.
110
+
111
+ The cron job used in the previous version of this cookbook is removed, but it does not remove any existing cron job from your system (so it doesn't break anything unexpectedly). We recommend setting up logrotate for the logfiles instead.
112
+
113
+ The `log_dir` will be concatenated with `per_host_dir` to store the logs for each client. Modify the attribute to have a value that is allowed by rsyslogs template matching values, see the rsyslog documentation for this.
114
+
115
+ Directory structure:
116
+
117
+ ```erb
118
+ <%= @log_dir %>/<%= @per_host_dir %>/"logfile"
119
+ ```
120
+
121
+ For example for the system with hostname `www`:
122
+
123
+ ```text
124
+ /srv/rsyslog/2011/11/19/www/messages
125
+ ```
126
+
127
+ For example, to change this to just the hostname, set the attribute `node['rsyslog']['per_host_dir']` via a role:
128
+
129
+ ```ruby
130
+ "rsyslog" => { "per_host_dir" => "%HOSTNAME%" }
131
+ ```
132
+
133
+ At this time, the server can only listen on UDP *or* TCP.
134
+
135
+ Resources
136
+ =========
137
+
138
+ file_input
139
+ ----------
140
+
141
+ Configures a [text file input
142
+ monitor](http://www.rsyslog.com/doc/imfile.html) to push a log file into
143
+ rsyslog.
144
+
145
+ Attributes:
146
+ * `name`: name of the resource, also used for the syslog tag. Required.
147
+ * `file`: file path for input file to monitor. Required.
148
+ * `priority`: config order priority. Defaults to `99`.
149
+ * `severity`: syslog severity. Must be one of `emergency`, `alert`,
150
+ `critical`, `error`, `warning`, `notice`, `info` or `debug`. If
151
+ undefined, rsyslog interprets this as `notice`.
152
+ * `facility`: syslog facility. Must be one of `auth`, `authpriv`,
153
+ `daemon`, `cron`, `ftp`, `lpr`, `kern`, `mail`, `news`, `syslog`,
154
+ `user`, `uucp`, `local0`, ... , `local7`. If undefined, rsyslog
155
+ interprets this as `local0`.
156
+ * `cookbook`: cookbook containing the template. Defaults to `rsyslog`.
157
+ * `source`: template file source. Defaults to `file-input.conf.erb`
158
+
159
+
160
+ Usage
161
+ =====
162
+ Use `recipe[rsyslog]` to install and start rsyslog as a basic configured service for standalone systems.
163
+
164
+ Use `recipe[rsyslog::client]` to have nodes log to a remote server (which is found via the `server_ip` attribute or by the recipe's search call -- see __client__)
165
+
166
+ Use `recipe[rsyslog::server]` to set up a rsyslog server. It will listen on `node['rsyslog']['port']` protocol `node['rsyslog']['protocol']`.
167
+
168
+ If you set up a different kind of centralized loghost (syslog-ng, graylog2, logstash, etc), you can still send log messages to it as long as the port and protocol match up with the server software. See __Examples__
169
+
170
+ Use `rsyslog_file_input` within your recipes to forward log files to
171
+ your remote syslog server.
172
+
173
+
174
+ ### Examples
175
+ A `base` role (e.g., roles/base.rb), applied to all nodes so they are syslog clients:
176
+
177
+ ```ruby
178
+ name "base"
179
+ description "Base role applied to all nodes
180
+ run_list("recipe[rsyslog::client]")
181
+ ```
182
+
183
+ Then, a role for the loghost (should only be one):
184
+
185
+ ```ruby
186
+ name "loghost"
187
+ description "Central syslog server"
188
+ run_list("recipe[rsyslog::server]")
189
+ ```
190
+
191
+ By default this will set up the clients search for a node with the `loghost` role to talk to the server on TCP port 514. Change the `protocol` and `port` rsyslog attributes to modify this.
192
+
193
+ If you want to specify another syslog compatible server with a role other than loghost, simply fill free to use the `server_ip` attribute or the `server_search` attribute.
194
+
195
+ Example role that sets the per host directory:
196
+
197
+ ```ruby
198
+ name "loghost"
199
+ description "Central syslog server"
200
+ run_list("recipe[rsyslog::server]")
201
+ default_attributes(
202
+ "rsyslog" => { "per_host_dir" => "%HOSTNAME%" }
203
+ )
204
+ ```
205
+
206
+ Default rsyslog options are rendered for RHEL family platforms, in `/etc/rsyslog.d/50-default.conf`
207
+ with other platforms using a configuration like Debian family defaults. You can override these
208
+ log facilities and destinations using the `rsyslog['default_facility_logs']` hash.
209
+
210
+ ```ruby
211
+ name "facility_log_example"
212
+ run_list("recipe[rsyslog::default]")
213
+ default_attributes(
214
+ "rsyslog" => {
215
+ "default_facility_logs" => {
216
+ '*.info;mail.none;authpriv.none;cron.none' => "/var/log/messages",
217
+ 'authpriv' => '/var/log/secure',
218
+ 'mail.*' => '-/var/log/maillog',
219
+ '*.emerg' => '*'
220
+ }
221
+ }
222
+ )
223
+ ```
224
+
225
+ Development
226
+ -----------
227
+ This section details "quick development" steps. For a detailed explanation, see [[Contributing.md]].
228
+
229
+ 1. Clone this repository from GitHub:
230
+
231
+ $ git clone git@github.com:chef-cookbooks/rsyslog.git
232
+
233
+ 2. Create a git branch
234
+
235
+ $ git checkout -b my_bug_fix
236
+
237
+ 3. Install dependencies:
238
+
239
+ $ bundle install
240
+
241
+ 4. Make your changes/patches/fixes, committing appropriately
242
+ 5. **Write tests**
243
+ 6. Run the tests:
244
+ - bundle exec foodcritic -f any .
245
+ - bundle exec rspec
246
+ - bundle exec rubocop
247
+ - bundle exec kitchen test
248
+
249
+ In detail:
250
+ - Foodcritic will catch any Chef-specific style errors
251
+ - RSpec will run the unit tests
252
+ - Rubocop will check for Ruby-specific style errors
253
+ - Test Kitchen will run and converge the recipes
254
+
255
+
256
+ License & Authors
257
+ -----------------
258
+ - Author:: Joshua Timberman (<joshua@chef.io>)
259
+ - Author:: Denis Barishev (<denz@twiket.com>)
260
+ - Author:: Tim Smith (<tsmith84@gmail.com>)
261
+
262
+ ```text
263
+ Copyright:: 2009-2015, Chef Software, Inc
264
+
265
+ Licensed under the Apache License, Version 2.0 (the "License");
266
+ you may not use this file except in compliance with the License.
267
+ You may obtain a copy of the License at
268
+
269
+ http://www.apache.org/licenses/LICENSE-2.0
270
+
271
+ Unless required by applicable law or agreed to in writing, software
272
+ distributed under the License is distributed on an "AS IS" BASIS,
273
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
274
+ See the License for the specific language governing permissions and
275
+ limitations under the License.
276
+ ```
@@ -0,0 +1,131 @@
1
+ #
2
+ # Cookbook Name:: rsyslog
3
+ # Attributes:: default
4
+ #
5
+ # Copyright 2009-2015, Chef Software, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ default['rsyslog']['default_log_dir'] = '/var/log'
21
+ default['rsyslog']['log_dir'] = '/srv/rsyslog'
22
+ default['rsyslog']['working_dir'] = '/var/spool/rsyslog'
23
+ default['rsyslog']['server'] = false
24
+ default['rsyslog']['use_relp'] = false
25
+ default['rsyslog']['relp_port'] = 20_514
26
+ default['rsyslog']['protocol'] = 'tcp'
27
+ default['rsyslog']['bind'] = '*'
28
+ default['rsyslog']['port'] = 514
29
+ default['rsyslog']['server_ip'] = nil
30
+ default['rsyslog']['server_search'] = 'role:loghost'
31
+ default['rsyslog']['remote_logs'] = true
32
+ default['rsyslog']['per_host_dir'] = '%$YEAR%/%$MONTH%/%$DAY%/%HOSTNAME%'
33
+ default['rsyslog']['max_message_size'] = '2k'
34
+ default['rsyslog']['preserve_fqdn'] = 'off'
35
+ default['rsyslog']['high_precision_timestamps'] = false
36
+ default['rsyslog']['repeated_msg_reduction'] = 'on'
37
+ default['rsyslog']['logs_to_forward'] = '*.*'
38
+ default['rsyslog']['enable_imklog'] = true
39
+ default['rsyslog']['config_prefix'] = '/etc'
40
+ default['rsyslog']['default_file_template'] = nil
41
+ default['rsyslog']['default_remote_template'] = nil
42
+ default['rsyslog']['rate_limit_interval'] = nil
43
+ default['rsyslog']['rate_limit_burst'] = nil
44
+ default['rsyslog']['enable_tls'] = false
45
+ default['rsyslog']['action_queue_max_disk_space'] = '1G'
46
+ default['rsyslog']['tls_ca_file'] = nil
47
+ default['rsyslog']['tls_certificate_file'] = nil
48
+ default['rsyslog']['tls_key_file'] = nil
49
+ default['rsyslog']['tls_auth_mode'] = 'anon'
50
+ default['rsyslog']['use_local_ipv4'] = false
51
+ default['rsyslog']['allow_non_local'] = false
52
+ default['rsyslog']['custom_remote'] = [{}]
53
+ default['rsyslog']['additional_directives'] = {}
54
+
55
+ # The most likely platform-specific attributes
56
+ default['rsyslog']['service_name'] = 'rsyslog'
57
+ default['rsyslog']['user'] = 'root'
58
+ default['rsyslog']['group'] = 'adm'
59
+ default['rsyslog']['priv_seperation'] = false
60
+ default['rsyslog']['priv_user'] = nil
61
+ default['rsyslog']['priv_group'] = nil
62
+ default['rsyslog']['modules'] = %w(imuxsock imklog)
63
+
64
+ # platform family specific attributes
65
+ case node['platform_family']
66
+ when 'rhel', 'fedora'
67
+ default['rsyslog']['working_dir'] = '/var/lib/rsyslog'
68
+ # format { facility => destination }
69
+ default['rsyslog']['default_facility_logs'] = {
70
+ '*.info;mail.none;authpriv.none;cron.none' => "#{node['rsyslog']['default_log_dir']}/messages",
71
+ 'authpriv.*' => "#{node['rsyslog']['default_log_dir']}/secure",
72
+ 'mail.*' => "-#{node['rsyslog']['default_log_dir']}/maillog",
73
+ 'cron.*' => "#{node['rsyslog']['default_log_dir']}/cron",
74
+ '*.emerg' => ':omusrmsg:*',
75
+ 'uucp,news.crit' => "#{node['rsyslog']['default_log_dir']}/spooler",
76
+ 'local7.*' => "#{node['rsyslog']['default_log_dir']}/boot.log"
77
+ }
78
+ # RHEL >= 7 and Fedora >= 19 use journald in systemd. Amazon Linux doesn't.
79
+ if node['platform'] != 'amazon' && (node['platform_version'].to_i == 7 || node['platform_version'].to_i >= 19)
80
+ default['rsyslog']['modules'] = %w(imuxsock imjournal)
81
+ default['rsyslog']['additional_directives'] = { 'OmitLocalLogging' => 'on', 'IMJournalStateFile' => 'imjournal.state' }
82
+ end
83
+ else
84
+ # format { facility => destination }
85
+ default['rsyslog']['default_facility_logs'] = {
86
+ 'auth,authpriv.*' => "#{node['rsyslog']['default_log_dir']}/auth.log",
87
+ '*.*;auth,authpriv.none' => "-#{node['rsyslog']['default_log_dir']}/syslog",
88
+ 'daemon.*' => "-#{node['rsyslog']['default_log_dir']}/daemon.log",
89
+ 'kern.*' => "-#{node['rsyslog']['default_log_dir']}/kern.log",
90
+ 'mail.*' => "-#{node['rsyslog']['default_log_dir']}/mail.log",
91
+ 'user.*' => "-#{node['rsyslog']['default_log_dir']}/user.log",
92
+ 'mail.info' => "-#{node['rsyslog']['default_log_dir']}/mail.info",
93
+ 'mail.warn' => "-#{node['rsyslog']['default_log_dir']}/mail.warn",
94
+ 'mail.err' => "#{node['rsyslog']['default_log_dir']}/mail.err",
95
+ 'news.crit' => "#{node['rsyslog']['default_log_dir']}/news/news.crit",
96
+ 'news.err' => "#{node['rsyslog']['default_log_dir']}/news/news.err",
97
+ 'news.notice' => "-#{node['rsyslog']['default_log_dir']}/news/news.notice",
98
+ '*.=debug;auth,authpriv.none;news.none;mail.none' => "-#{node['rsyslog']['default_log_dir']}/debug",
99
+ '*.=info;*.=notice;*.=warn;auth,authpriv.none;cron,daemon.none;mail,news.none' => "-#{node['rsyslog']['default_log_dir']}/messages",
100
+ '*.emerg' => ':omusrmsg:*'
101
+ }
102
+ end
103
+
104
+ # rsyslog 3/4 do not support the new :omusrmsg:* format and need * instead
105
+ if (node['platform'] == 'ubuntu' && node['platform_version'].to_i < 12) || (node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6)
106
+ default['rsyslog']['default_facility_logs']['*.emerg'] = '*'
107
+ end
108
+
109
+ # platform specific attributes
110
+ case node['platform']
111
+ when 'ubuntu'
112
+ # syslog user introduced with natty package
113
+ if node['platform_version'].to_f >= 11.04
114
+ default['rsyslog']['user'] = 'syslog'
115
+ default['rsyslog']['group'] = 'adm'
116
+ default['rsyslog']['priv_seperation'] = true
117
+ default['rsyslog']['priv_group'] = 'syslog'
118
+ end
119
+ when 'arch'
120
+ default['rsyslog']['service_name'] = 'rsyslogd'
121
+ when 'smartos'
122
+ default['rsyslog']['config_prefix'] = '/opt/local/etc'
123
+ default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
124
+ default['rsyslog']['group'] = 'root'
125
+ when 'omnios'
126
+ default['rsyslog']['service_name'] = 'system/rsyslogd'
127
+ default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
128
+ default['rsyslog']['group'] = 'root'
129
+ when 'suse'
130
+ default['rsyslog']['service_name'] = 'syslog'
131
+ end
@@ -0,0 +1,25 @@
1
+ module RsyslogCookbook
2
+ # helpers for the various service providers on Ubuntu systems
3
+ module Helpers
4
+ def find_provider
5
+ if Chef::VersionConstraint.new('>= 15.04').include?(node['platform_version'])
6
+ service_provider = Chef::Provider::Service::Systemd
7
+ elsif Chef::VersionConstraint.new('>= 12.04').include?(node['platform_version'])
8
+ service_provider = Chef::Provider::Service::Upstart
9
+ else
10
+ service_provider = nil
11
+ end
12
+ service_provider
13
+ end
14
+
15
+ def declare_rsyslog_service
16
+ service_provider = 'ubuntu' == node['platform'] ? find_provider : nil
17
+
18
+ service node['rsyslog']['service_name'] do
19
+ supports restart: true, status: true
20
+ action [:enable, :start]
21
+ provider service_provider
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1 @@
1
+ {"name":"rsyslog","version":"2.2.0","description":"Installs and configures rsyslog","long_description":"rsyslog Cookbook\n================\n[![Build Status](https://travis-ci.org/chef-cookbooks/rsyslog.svg?branch=master)](http://travis-ci.org/chef-cookbooks/rsyslog)\n[![Cookbook Version](https://img.shields.io/cookbook/v/rsyslog.svg)](https://supermarket.chef.io/cookbooks/rsyslog)\n\nInstalls and configures rsyslog to replace sysklogd for client and/or server use. By default, the service will be configured to log to files on local disk. See the Recipes and Examples sections for other uses.\n\n\nRequirements\n------------\n#### Platforms\n- Debian/Ubuntu\n- RHEL/CentOS/Scientific/Amazon/Oracle\n- Fedora 20+\n- OmniOS r151006c\n\n#### Chef\n- Chef 11+\n\n#### Cookbooks\n- none\n\n#### Other\nTo use the `recipe[rsyslog::client]` recipe, you'll need to set up the `rsyslog.server_search` or `rsyslog.server_ip` attributes. See the __Recipes__ and __Examples__ sections below.\n\n\nAttributes\n----------\nSee `attributes/default.rb` for default values.\n\n* `node['rsyslog']['log_dir']` - If the node is an rsyslog server, this specifies the directory where the logs should be stored.\n* `node['rsyslog']['working_dir']` - The temporary working directory where messages are buffered\n* `node['rsyslog']['server']` - Determined automatically and set to true on the server.\n* `node['rsyslog']['server_ip']` - If not defined then search will be used to determine rsyslog server. Default is `nil`. This can be a string or an array.\n* `node['rsyslog']['server_search']` - Specify the criteria for the server search operation. Default is `role:loghost`.\n* `node['rsyslog']['protocol']` - Specify whether to use `udp` or `tcp` for remote loghost. Default is `tcp`. To use both specify both in a string e.g. 'udptcp'.\n* `node['rsyslog']['bind']` - Specify the address to which the server should be listening; only use with `node['rsyslog']['protocol'] = 'udp'` because the feature does not work with the `tcp` protocol ([more info](http://www.rsyslog.com/doc/master/configuration/modules/imtcp.html#caveats-known-bugs)).\n* `node['rsyslog']['port']` - Specify the port which rsyslog should connect to a remote loghost.\n* `node['rsyslog']['remote_logs']` - Specify whether to send all logs to a remote server (client option). Default is `true`.\n* `node['rsyslog']['per_host_dir']` - \"PerHost\" directories for template statements in `35-server-per-host.conf`. Default value is the previous cookbook version's value, to preserve compatibility. See __server__ recipe below.\n* `node['rsyslog']['priv_seperation']` - Whether to use privilege separation or not.\n* `node['rsyslog']['priv_user']` - User to run as when using privilege separation. Defult is `node['rsyslog']['user']`\n* `node['rsyslog']['priv_group']` - Group to run as when using privilege separation. Defult is `node['rsyslog']['group']`\n* `node['rsyslog']['max_message_size']` - Specify the maximum allowed message size. Default is 2k.\n* `node['rsyslog']['user']` - Who should own the configuration files and directories\n* `node['rsyslog']['group']` - Who should group-own the configuration files and directories\n* `node['rsyslog']['defaults_file']` - The full path to the defaults/sysconfig file for the service.\n* `node['rsyslog']['service_name']` - The platform-specific name of the service\n* `node['rsyslog']['preserve_fqdn']` - Value of the `$PreserveFQDN` configuration directive in `/etc/rsyslog.conf`. Default is 'off' for compatibility purposes.\n* `node['rsyslog']['high_precision_timestamps']` - Enable high precision timestamps, instead of the \"old style\" format. Default is 'false'.\n* `node['rsyslog']['repeated_msg_reduction']` - Value of `$RepeatedMsgReduction` configuration directive in `/etc/rsyslog.conf`. Default is 'on'\n* `node['rsyslog']['logs_to_forward']` - Specifies what logs should be sent to the remote rsyslog server. Default is all ( \\*.\\* ).\n* `node['rsyslog']['default_log_dir']` - log directory used in `50-default.conf` template, defaults to `/var/log`\n* `node['rsyslog']['default_facility_logs']` - Hash containing log facilities and destinations used in `50-default.conf` template.\n* `node['rsyslog']['default_file_template']` - The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for local log files.\n* `node['rsyslog']['default_remote_template']` - The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for sending to remote servers.\n* `node['rsyslog']['rate_limit_interval']` - Value of the $SystemLogRateLimitInterval configuration directive in `/etc/rsyslog.conf`. Default is nil, leaving it to the platform default.\n* `node['rsyslog']['rate_limit_burst']` - Value of the $SystemLogRateLimitBurst configuration directive in `/etc/rsyslog.conf`. Default is nil, leaving it to the platform default.\n* `node['rsyslog']['action_queue_max_disk_space']` - Max amount of disk space the disk-assisted queue is allowed to use ([more info](http://www.rsyslog.com/doc/queues.html)).\n* `node['rsyslog']['enable_tls']` - Whether or not to enable TLS encryption. When enabled, forces protocol to `tcp`. Default is `false`.\n* `node['rsyslog']['tls_ca_file']` - Path to TLS CA file. Required for both server and clients.\n* `node['rsyslog']['tls_certificate_file']` - Path to TLS certificate file. Required for server, optional for clients.\n* `node['rsyslog']['tls_key_file']` - Path to TLS key file. Required for server, optional for clients.\n* `node['rsyslog']['tls_auth_mode']` - Value for `$InputTCPServerStreamDriverAuthMode`/`$ActionSendStreamDriverAuthMode`, determines whether client certs are validated. Defaults to `anon` (no validation).\n* `node['rsyslog']['use_local_ipv4']` - Whether or not to make use the remote local IPv4 address on cloud systems when searching for servers (where available). Default is 'false'.\n* `node['rsyslog']['allow_non_local']` - Whether or not to allow non-local messages. If 'false', incoming messages are only allowed from 127.0.0.1. Default is 'false'.\n* `node['rsyslog']['custom_remote']` - Array of hashes for configuring custom remote server targets\n* `node['rsyslog']['additional_directives']` - Hash of additional directives and their values to place in the main rsyslog config file\n\nRecipes\n-------\n### default\nInstalls the rsyslog package, manages the rsyslog service and sets up basic configuration for a standalone machine.\n\n### client\nIncludes `recipe[rsyslog]`.\n\nUses `node['rsyslog']['server_ip']` or Chef search (in that precedence order) to determine the remote syslog server's IP address. If search is used, the search query will look for the first `ipaddress` returned from the criteria specified in `node['rsyslog']['server_search']`.\n\nYou can use `node['rsyslog']['custom_config']` to define custom entries for sending logs to remote servers.\nAvailable attributes:\n```\n 'server': Ip/hostname of remote syslog server (Required)\n 'port': Port to send logs to\n 'logs': Syslog log facilities to send (auth, authpriv, daemon, etc)\n 'protocol': Can be tcp or udp\n 'remote_template': Rsyslog template used for the messages\n```\n\nExample:\n\n```ruby\nnode['rsyslog']['custom_remote'] = [{ 'server' => '10.10.4.4', 'port' => '567', 'logs' => 'auth.*,mail.*', 'protocol' => 'udp', 'remote_template' => 'RSYSLOG_SyslogProtocol23Format'},\n { 'server' => '10.0.0.3', 'port' => '555', 'logs' => 'authpriv,daemon.*' } ]\n```\n\nThe server key is required; if other keys are left out, the default global values will be used (eg `node['rsyslog']['port']` will be used if 'port' is omitted)\n\n\nIf the node itself is a rsyslog server ie it has `rsyslog.server` set to true then the configuration is skipped.\n\nIf the node had an `/etc/rsyslog.d/35-server-per-host.conf` file previously configured, this file gets removed to prevent duplicate logging.\n\nAny previous logs are not cleaned up from the `log_dir`.\n\n### server\nConfigures the node to be a rsyslog server. The chosen rsyslog server node should be defined in the `server_ip` attribute or resolvable by the specified search criteria specified in `node['rsyslog']['server_search]` (so that nodes making use of the `client` recipe can find the server to log to).\n\nThis recipe will create the logs in `node['rsyslog']['log_dir']`, and the configuration is in `/etc/rsyslog.d/server.conf`. This recipe also removes any previous configuration to a remote server by removing the `/etc/rsyslog.d/remote.conf` file.\n\nThe cron job used in the previous version of this cookbook is removed, but it does not remove any existing cron job from your system (so it doesn't break anything unexpectedly). We recommend setting up logrotate for the logfiles instead.\n\nThe `log_dir` will be concatenated with `per_host_dir` to store the logs for each client. Modify the attribute to have a value that is allowed by rsyslogs template matching values, see the rsyslog documentation for this.\n\nDirectory structure:\n\n```erb\n<%= @log_dir %>/<%= @per_host_dir %>/\"logfile\"\n```\n\nFor example for the system with hostname `www`:\n\n```text\n/srv/rsyslog/2011/11/19/www/messages\n```\n\nFor example, to change this to just the hostname, set the attribute `node['rsyslog']['per_host_dir']` via a role:\n\n```ruby\n\"rsyslog\" => { \"per_host_dir\" => \"%HOSTNAME%\" }\n```\n\nAt this time, the server can only listen on UDP *or* TCP.\n\nResources\n=========\n\nfile_input\n----------\n\nConfigures a [text file input\nmonitor](http://www.rsyslog.com/doc/imfile.html) to push a log file into\nrsyslog.\n\nAttributes:\n* `name`: name of the resource, also used for the syslog tag. Required.\n* `file`: file path for input file to monitor. Required.\n* `priority`: config order priority. Defaults to `99`.\n* `severity`: syslog severity. Must be one of `emergency`, `alert`,\n`critical`, `error`, `warning`, `notice`, `info` or `debug`. If\nundefined, rsyslog interprets this as `notice`.\n* `facility`: syslog facility. Must be one of `auth`, `authpriv`,\n`daemon`, `cron`, `ftp`, `lpr`, `kern`, `mail`, `news`, `syslog`,\n`user`, `uucp`, `local0`, ... , `local7`. If undefined, rsyslog\ninterprets this as `local0`.\n* `cookbook`: cookbook containing the template. Defaults to `rsyslog`.\n* `source`: template file source. Defaults to `file-input.conf.erb`\n\n\nUsage\n=====\nUse `recipe[rsyslog]` to install and start rsyslog as a basic configured service for standalone systems.\n\nUse `recipe[rsyslog::client]` to have nodes log to a remote server (which is found via the `server_ip` attribute or by the recipe's search call -- see __client__)\n\nUse `recipe[rsyslog::server]` to set up a rsyslog server. It will listen on `node['rsyslog']['port']` protocol `node['rsyslog']['protocol']`.\n\nIf you set up a different kind of centralized loghost (syslog-ng, graylog2, logstash, etc), you can still send log messages to it as long as the port and protocol match up with the server software. See __Examples__\n\nUse `rsyslog_file_input` within your recipes to forward log files to\nyour remote syslog server.\n\n\n### Examples\nA `base` role (e.g., roles/base.rb), applied to all nodes so they are syslog clients:\n\n```ruby\nname \"base\"\ndescription \"Base role applied to all nodes\nrun_list(\"recipe[rsyslog::client]\")\n```\n\nThen, a role for the loghost (should only be one):\n\n```ruby\nname \"loghost\"\ndescription \"Central syslog server\"\nrun_list(\"recipe[rsyslog::server]\")\n```\n\nBy default this will set up the clients search for a node with the `loghost` role to talk to the server on TCP port 514. Change the `protocol` and `port` rsyslog attributes to modify this.\n\nIf you want to specify another syslog compatible server with a role other than loghost, simply fill free to use the `server_ip` attribute or the `server_search` attribute.\n\nExample role that sets the per host directory:\n\n```ruby\nname \"loghost\"\ndescription \"Central syslog server\"\nrun_list(\"recipe[rsyslog::server]\")\ndefault_attributes(\n \"rsyslog\" => { \"per_host_dir\" => \"%HOSTNAME%\" }\n)\n```\n\nDefault rsyslog options are rendered for RHEL family platforms, in `/etc/rsyslog.d/50-default.conf`\nwith other platforms using a configuration like Debian family defaults. You can override these\nlog facilities and destinations using the `rsyslog['default_facility_logs']` hash.\n\n```ruby\nname \"facility_log_example\"\nrun_list(\"recipe[rsyslog::default]\")\ndefault_attributes(\n \"rsyslog\" => {\n \"default_facility_logs\" => {\n '*.info;mail.none;authpriv.none;cron.none' => \"/var/log/messages\",\n 'authpriv' => '/var/log/secure',\n 'mail.*' => '-/var/log/maillog',\n '*.emerg' => '*'\n }\n }\n)\n```\n\nDevelopment\n-----------\nThis section details \"quick development\" steps. For a detailed explanation, see [[Contributing.md]].\n\n1. Clone this repository from GitHub:\n\n $ git clone git@github.com:chef-cookbooks/rsyslog.git\n\n2. Create a git branch\n\n $ git checkout -b my_bug_fix\n\n3. Install dependencies:\n\n $ bundle install\n\n4. Make your changes/patches/fixes, committing appropriately\n5. **Write tests**\n6. Run the tests:\n - bundle exec foodcritic -f any .\n - bundle exec rspec\n - bundle exec rubocop\n - bundle exec kitchen test\n\n In detail:\n - Foodcritic will catch any Chef-specific style errors\n - RSpec will run the unit tests\n - Rubocop will check for Ruby-specific style errors\n - Test Kitchen will run and converge the recipes\n\n\nLicense & Authors\n-----------------\n- Author:: Joshua Timberman (<joshua@chef.io>)\n- Author:: Denis Barishev (<denz@twiket.com>)\n- Author:: Tim Smith (<tsmith84@gmail.com>)\n\n```text\nCopyright:: 2009-2015, Chef Software, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache 2.0","platforms":{"ubuntu":">= 10.04","debian":">= 5.0","redhat":">= 5.0","centos":">= 5.0","fedora":">= 20.0","scientific":">= 0.0.0","amazon":">= 0.0.0","oracle":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{"rsyslog":{"display_name":"Rsyslog","description":"Hash of Rsyslog attributes","type":"hash"},"rsyslog/log_dir":{"display_name":"Rsyslog Log Directory","description":"Filesystem location of logs from clients","default":"/srv/rsyslog"},"rsyslog/server":{"display_name":"Rsyslog Server?","description":"Is this node an rsyslog server?","default":"false"},"rsyslog/server_ip":{"display_name":"Rsyslog Server IP Address","description":"Set rsyslog server ip address explicitly"},"rsyslog/server_search":{"display_name":"Rsyslog Server Search Criteria","description":"Set the search criteria for rsyslog server resolving","default":"role:loghost"},"rsyslog/protocol":{"display_name":"Rsyslog Protocol","description":"Set which network protocol to use for rsyslog","default":"tcp"},"rsyslog/port":{"display_name":"Rsyslog Port","description":"Port that Rsyslog listens for incoming connections","default":"514"},"rsyslog/remote_logs":{"display_name":"Remote Logs","description":"Specifies whether redirect all log from client to server","default":"true"},"rsyslog/user":{"display_name":"User","description":"The owner of Rsyslog config files and directories","default":"root"},"rsyslog/group":{"display_name":"Group","description":"The group-owner of Rsyslog config files and directories","default":"adm"},"rsyslog/service_name":{"display_name":"Service name","description":"The name of the service for the platform","default":"rsyslog"},"rsyslog/max_message_size":{"display_name":"Maximum Rsyslog message size","description":"Specifies the maximum size of allowable Rsyslog messages","default":"2k"},"rsyslog/preserve_fqdn":{"display_name":"Preserve FQDN","description":"Specifies if the short or full host name will be used. The default off setting is more compatible.","default":"off"},"rsyslog/repeated_msg_reduction":{"display_name":"Filter duplicated messages","description":"Specifies whether or not repeated messages should be reduced.","default":"on"},"rsyslog/priv_seperation":{"display_name":"Privilege separation","description":"Whether or not to make use of Rsyslog privilege separation","default":"false"},"rsyslog/default_file_template":{"display_name":"Default file log format template","description":"The name of a pre-defined log format template (ie - `RSYSLOG_FileFormat`), used for local log files."},"rsyslog/default_remote_template":{"display_name":"Default remote log format template","description":"The name of a pre-defined log format template (ie - `RSYSLOG_SyslogProtocol23Format`), used for remote log forwarding."},"rsyslog/enable_tls":{"display_name":"Enable TLS","description":"Whether or not to enable TLS encryption. When enabled, forces protocol to \"tcp\"","default":"false"},"rsyslog/tls_ca_file":{"display_name":"TLS CA file","description":"Path to TLS CA file. Required for both server and clients."},"rsyslog/tls_certificate_file":{"display_name":"TLS certificate file","description":"Path to TLS certificate file. Required for server, optional for clients."},"rsyslog/tls_key_file":{"display_name":"TLS key file","description":"Path to TLS key file. Required for server, optional for clients."},"rsyslog/tls_auth_mode":{"display_name":"TLS auth mode","description":"Value for \"$InputTCPServerStreamDriverAuthMode\"/\"$ActionSendStreamDriverAuthMode\", determines whether client certs are validated.","default":"anon"},"rsyslog/use_local_ipv4":{"display_name":"Try to use local IPv4 address","description":"Whether or not to make use the remote local IPv4 address on cloud systems when searching for servers (where available).","default":"false"},"rsyslog/allow_non_local":{"display_name":"Allow non-local messages","description":"Allow processing of messages coming any IP, not just 127.0.0.1","default":"false"}},"groupings":{},"recipes":{"rsyslog":"Installs rsyslog","rsyslog::client":"Sets up a client to log to a remote rsyslog server","rsyslog::server":"Sets up an rsyslog server"},"source_url":"https://github.com/chef-cookbooks/rsyslog","issues_url":"https://github.com/chef-cookbooks/rsyslog/issues"}
@@ -0,0 +1,44 @@
1
+ # Cookbook Name:: rsyslog
2
+ # Provider:: file_input
3
+ #
4
+ # Copyright 2012-2015, Joseph Holsten
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # support whyrun
20
+ def whyrun_supported?
21
+ true
22
+ end
23
+
24
+ use_inline_resources
25
+
26
+ include RsyslogCookbook::Helpers
27
+
28
+ action :create do
29
+ declare_rsyslog_service
30
+
31
+ template "/etc/rsyslog.d/#{new_resource.priority}-#{new_resource.name}.conf" do
32
+ mode '0664'
33
+ owner node['rsyslog']['user']
34
+ group node['rsyslog']['group']
35
+ source new_resource.source
36
+ cookbook new_resource.cookbook
37
+ variables 'file_name' => new_resource.file,
38
+ 'tag' => new_resource.name,
39
+ 'state_file' => new_resource.name,
40
+ 'severity' => new_resource.severity,
41
+ 'facility' => new_resource.facility
42
+ notifies :restart, resources('service[rsyslog]')
43
+ end
44
+ end