File: //lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_rsyslog.cpython-36.pyc
3
\�me�5 �
@ s� U d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z m
Z
mZ ddlm
Z
ddlmZ ddlmZmZ ddlmZmZ dd lmZ d
Zddd
eegeed�ed�ed�gdgd�Zeee�Z dddi i ddgdd�Zddgd�ddgd�ddgd�d�Zeje�Zejd�Z ejd�Z!ed �d!d"�Z"d8d#d$�Z#d9d%d&�Z$e%ee%d'�d(d)�Z&d*d+� Z'd:d,d-�Z(G d.d/� d/�Z)d;d0d1�Z*e
dd2�d3d4�Z+e,ee
e-dd5�d6d7�Z.dS )<z-Rsyslog: Configure system logging via rsyslog� N)�dedent)�log�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS�Distro)�PER_INSTANCEam This module configures remote system logging using rsyslog.
Configuration for remote servers can be specified in ``configs``, but for
convenience it can be specified as key value pairs in ``remotes``.
This module can install rsyslog if not already present on the system using the
``install_rsyslog``, ``packages``, and ``check_exe`` options. Installation
may not work on systems where this module runs before networking is up.
.. note::
On BSD cloud-init will attempt to disable and stop the base system syslogd.
This may fail on a first run.
We recommend creating images with ``service syslogd disable``.
Z
cc_rsyslogZRsyslogz$Configure system logging via rsyslogz� rsyslog:
remotes:
maas: 192.168.1.1
juju: 10.0.4.1
service_reload_command: auto
a7 rsyslog:
config_dir: /opt/etc/rsyslog.d
config_filename: 99-late-cloud-config.conf
configs:
- "*.* @@192.158.1.1"
- content: "*.* @@192.0.2.1:10514"
filename: 01-example.conf
- content: |
*.* @@syslogd.example.com
remotes:
maas: 192.168.1.1
juju: 10.0.4.1
service_reload_command: [your, syslog, restart, command]
a # default (no) configuration with package installation on FreeBSD
rsyslog:
config_dir: /usr/local/etc/rsyslog.d
check_exe: "rsyslogd"
packages: ["rsyslogd"]
install_rsyslog: True
�rsyslog)�id�name�title�descriptionZdistrosZ frequencyZexamplesZactivate_by_schema_keysz/etc/rsyslog.dz20-cloud-config.conf�autoZrsyslogdF)�
config_dir�config_filename�service_reload_command�remotes�configs� check_exe�packages�install_rsyslogz/usr/local/etc/rsyslog.d)r r zsysutils/rsyslogz/usr/pkg/etc/rsyslog.d)ZfreebsdZopenbsdZnetbsdz[ ]*[#]+[ ]*z_^(?P<proto>[@]{0,2})(([\[](?P<bracket_addr>[^\]]*)[\]])|(?P<addr>[^:]*))([:](?P<port>[0-9]+))?$)�distroc C s4 t }tjt�}| j|kr0tj||| j gdd�}|S )z�Construct a distro-specific rsyslog config dictionary by merging
distro specific changes into base config.
@param distro: String providing the distro class name.
@returns: Dict of distro configurations for ntp clients.
T)�reverse)�DISTRO_OVERRIDES�copy�RSYSLOG_CONFIGZosfamilyr Z
mergemanydictr )r Zdcfg�cfg� r! � /usr/lib/python3.6/cc_rsyslog.py�distro_default_rsyslog_config� s
r# c C s( t j|�rdS |dkrdg}| |� dS )ai Install rsyslog package if not already installed.
@param install_func: function. This parameter is invoked with the contents
of the packages parameter.
@param packages: list. This parameter defaults to ['rsyslog'].
@param check_exe: string. The name of a binary that indicates the package
the specified package is already installed.
Nr
)r Zwhich)Zinstall_funcr r r! r! r"