services: syslog: Use syslog-configuration.
* gnu/services/base.scm (<syslog-configuration>): New variable. (syslog-service-type): Use <syslog-configuration>. (syslog-service): Use <syslog-configuration>. * gnu/tests/base.scm (%avahi-os): Use <syslog-configuration>. * doc/guix.texi (syslog-configuration-type): Add @deftp. (syslog-service): Update @deffn.
This commit is contained in:
		
							parent
							
								
									f2901d824a
								
							
						
					
					
						commit
						ec2e2f6ce2
					
				
					 3 changed files with 43 additions and 16 deletions
				
			
		|  | @ -7719,12 +7719,23 @@ privacy---often the result of host name lookups is in local cache, so | ||||||
| external name servers do not even need to be queried. | external name servers do not even need to be queried. | ||||||
| @end defvr | @end defvr | ||||||
| 
 | 
 | ||||||
|  | @anchor{syslog-configuration-type} | ||||||
|  | @deftp {Data Type} syslog-configuration | ||||||
|  | This data type represents the configuration of the syslog daemon. | ||||||
| 
 | 
 | ||||||
| @deffn {Scheme Procedure} syslog-service @ | @table @asis | ||||||
|              [#:config-file @var{%default-syslog.conf}] | @item @code{syslogd} (default: @code{#~(string-append #$inetutils "/libexec/syslogd")}) | ||||||
| Return a service that runs @command{syslogd}.  If the configuration file | The syslog daemon to use. | ||||||
| name @var{config-file} is not specified, use some reasonable default | 
 | ||||||
| settings. | @item @code{config-file} (default: @code{%default-syslog.conf}) | ||||||
|  | The syslog configuration file to use. | ||||||
|  | 
 | ||||||
|  | @end table | ||||||
|  | @end deftp | ||||||
|  | 
 | ||||||
|  | @anchor{syslog-service} | ||||||
|  | @deffn {Scheme Procedure} syslog-service @var{config} | ||||||
|  | Return a service that runs a syslog daemon according to @var{config}. | ||||||
| 
 | 
 | ||||||
| @xref{syslogd invocation,,, inetutils, GNU Inetutils}, for more | @xref{syslogd invocation,,, inetutils, GNU Inetutils}, for more | ||||||
| information on the configuration file syntax. | information on the configuration file syntax. | ||||||
|  |  | ||||||
|  | @ -82,6 +82,9 @@ | ||||||
| 
 | 
 | ||||||
|             nscd-service-type |             nscd-service-type | ||||||
|             nscd-service |             nscd-service | ||||||
|  | 
 | ||||||
|  |             syslog-configuration | ||||||
|  |             syslog-configuration? | ||||||
|             syslog-service |             syslog-service | ||||||
|             syslog-service-type |             syslog-service-type | ||||||
|             %default-syslog.conf |             %default-syslog.conf | ||||||
|  | @ -885,17 +888,27 @@ given @var{config}---an @code{<nscd-configuration>} object.  @xref{Name | ||||||
| Service Switch}, for an example." | Service Switch}, for an example." | ||||||
|   (service nscd-service-type config)) |   (service nscd-service-type config)) | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | (define-record-type* <syslog-configuration> | ||||||
|  |   syslog-configuration  make-syslog-configuration | ||||||
|  |   syslog-configuration? | ||||||
|  |   (syslogd              syslog-configuration-syslogd | ||||||
|  |                         (default #~(string-append #$inetutils "/libexec/syslogd"))) | ||||||
|  |   (config-file          syslog-configuration-config-file | ||||||
|  |                         (default %default-syslog.conf))) | ||||||
|  | 
 | ||||||
| (define syslog-service-type | (define syslog-service-type | ||||||
|   (shepherd-service-type |   (shepherd-service-type | ||||||
|    'syslog |    'syslog | ||||||
|    (lambda (config-file) |    (lambda (config) | ||||||
|      (shepherd-service |      (shepherd-service | ||||||
|       (documentation "Run the syslog daemon (syslogd).") |       (documentation "Run the syslog daemon (syslogd).") | ||||||
|       (provision '(syslogd)) |       (provision '(syslogd)) | ||||||
|       (requirement '(user-processes)) |       (requirement '(user-processes)) | ||||||
|       (start #~(make-forkexec-constructor |       (start #~(make-forkexec-constructor | ||||||
|                 (list (string-append #$inetutils "/libexec/syslogd") |                 (list #$(syslog-configuration-syslogd config) | ||||||
|                       "--no-detach" "--rcfile" #$config-file))) |                       "--no-detach" | ||||||
|  |                       "--rcfile" #$(syslog-configuration-config-file config)))) | ||||||
|       (stop #~(make-kill-destructor)))))) |       (stop #~(make-kill-destructor)))))) | ||||||
| 
 | 
 | ||||||
| ;; Snippet adapted from the GNU inetutils manual. | ;; Snippet adapted from the GNU inetutils manual. | ||||||
|  | @ -921,14 +934,14 @@ Service Switch}, for an example." | ||||||
|      mail.*                                  /var/log/maillog |      mail.*                                  /var/log/maillog | ||||||
| ")) | ")) | ||||||
| 
 | 
 | ||||||
| (define* (syslog-service #:key (config-file %default-syslog.conf)) | (define* (syslog-service #:optional (config (syslog-configuration))) | ||||||
|   "Return a service that runs @command{syslogd}.  If configuration file |   "Return a service that runs @command{syslogd} and takes | ||||||
| name @var{config-file} is not specified, use some reasonable default | @var{<syslog-configuration>} as a parameter. | ||||||
| settings. |  | ||||||
| 
 | 
 | ||||||
| @xref{syslogd invocation,,, inetutils, GNU Inetutils}, for more | @xref{syslogd invocation,,, inetutils, GNU Inetutils}, for more | ||||||
| information on the configuration file syntax." | information on the configuration file syntax." | ||||||
|   (service syslog-service-type config-file)) |   (service syslog-service-type config)) | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| (define pam-limits-service-type | (define pam-limits-service-type | ||||||
|   (let ((security-limits |   (let ((security-limits | ||||||
|  |  | ||||||
|  | @ -384,9 +384,12 @@ functionality tests.") | ||||||
|                                               (log-file "/dev/console"))) |                                               (log-file "/dev/console"))) | ||||||
|                        (syslog-service-type config |                        (syslog-service-type config | ||||||
|                                             => |                                             => | ||||||
|                                             (plain-file |                                             (syslog-configuration | ||||||
|                                              "syslog.conf" |                                              (inherit config) | ||||||
|                                              "*.* /dev/console\n"))))))) |                                              (config-file | ||||||
|  |                                               (plain-file | ||||||
|  |                                                "syslog.conf" | ||||||
|  |                                                "*.* /dev/console\n"))))))))) | ||||||
| 
 | 
 | ||||||
| (define (run-nss-mdns-test) | (define (run-nss-mdns-test) | ||||||
|   ;; Test resolution of '.local' names via libc.  Start the marionette service |   ;; Test resolution of '.local' names via libc.  Start the marionette service | ||||||
|  |  | ||||||
		Reference in a new issue