]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/keystone/manifests/logging.pp
add stackforge/keystone to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / keystone / manifests / logging.pp
1 # Class keystone::logging
2 #
3 #  keystone extended logging configuration
4 #
5 # == parameters
6 #
7 #  [*logging_context_format_string*]
8 #    (optional) Format string to use for log messages with context.
9 #    Defaults to undef.
10 #    Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
11 #              [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
12 #
13 #  [*logging_default_format_string*]
14 #    (optional) Format string to use for log messages without context.
15 #    Defaults to undef.
16 #    Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
17 #              [-] %(instance)s%(message)s'
18 #
19 #  [*logging_debug_format_suffix*]
20 #    (optional) Formatted data to append to log format when level is DEBUG.
21 #    Defaults to undef.
22 #    Example: '%(funcName)s %(pathname)s:%(lineno)d'
23 #
24 #  [*logging_exception_prefix*]
25 #    (optional) Prefix each line of exception output with this format.
26 #    Defaults to undef.
27 #    Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
28 #
29 #  [*log_config_append*]
30 #    The name of an additional logging configuration file.
31 #    Defaults to undef.
32 #    See https://docs.python.org/2/howto/logging.html
33 #
34 #  [*default_log_levels*]
35 #    (optional) Hash of logger (keys) and level (values) pairs.
36 #    Defaults to undef.
37 #    Example:
38 #      { 'amqp'  => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
39 #           'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
40 #           'oslo.messaging' => 'INFO', 'iso8601' => 'WARN',
41 #           'requests.packages.urllib3.connectionpool' => 'WARN',
42 #           'urllib3.connectionpool' => 'WARN',
43 #           'websocket' => 'WARN', 'keystonemiddleware' => 'WARN',
44 #           'routes.middleware' => 'WARN', stevedore => 'WARN' }
45 #
46 #  [*publish_errors*]
47 #    (optional) Publish error events (boolean value).
48 #    Defaults to undef (false if unconfigured).
49 #
50 #  [*fatal_deprecations*]
51 #    (optional) Make deprecations fatal (boolean value)
52 #    Defaults to undef (false if unconfigured).
53 #
54 #  [*instance_format*]
55 #    (optional) If an instance is passed with the log message, format it
56 #               like this (string value).
57 #    Defaults to undef.
58 #    Example: '[instance: %(uuid)s] '
59 #
60 #  [*instance_uuid_format*]
61 #    (optional) If an instance UUID is passed with the log message, format
62 #               it like this (string value).
63 #    Defaults to undef.
64 #    Example: instance_uuid_format='[instance: %(uuid)s] '
65
66 #  [*log_date_format*]
67 #    (optional) Format string for %%(asctime)s in log records.
68 #    Defaults to undef.
69 #    Example: 'Y-%m-%d %H:%M:%S'
70
71 class keystone::logging(
72   $logging_context_format_string = undef,
73   $logging_default_format_string = undef,
74   $logging_debug_format_suffix   = undef,
75   $logging_exception_prefix      = undef,
76   $log_config_append             = undef,
77   $default_log_levels            = undef,
78   $publish_errors                = undef,
79   $fatal_deprecations            = undef,
80   $instance_format               = undef,
81   $instance_uuid_format          = undef,
82   $log_date_format               = undef,
83 ) {
84
85   if $logging_context_format_string {
86     keystone_config {
87       'DEFAULT/logging_context_format_string' :
88         value => $logging_context_format_string;
89       }
90     }
91   else {
92     keystone_config {
93       'DEFAULT/logging_context_format_string' : ensure => absent;
94       }
95     }
96
97   if $logging_default_format_string {
98     keystone_config {
99       'DEFAULT/logging_default_format_string' :
100         value => $logging_default_format_string;
101       }
102     }
103   else {
104     keystone_config {
105       'DEFAULT/logging_default_format_string' : ensure => absent;
106       }
107     }
108
109   if $logging_debug_format_suffix {
110     keystone_config {
111       'DEFAULT/logging_debug_format_suffix' :
112         value => $logging_debug_format_suffix;
113       }
114     }
115   else {
116     keystone_config {
117       'DEFAULT/logging_debug_format_suffix' : ensure => absent;
118       }
119     }
120
121   if $logging_exception_prefix {
122     keystone_config {
123       'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix;
124       }
125     }
126   else {
127     keystone_config {
128       'DEFAULT/logging_exception_prefix' : ensure => absent;
129       }
130     }
131
132   if $log_config_append {
133     keystone_config {
134       'DEFAULT/log_config_append' : value => $log_config_append;
135       }
136     }
137   else {
138     keystone_config {
139       'DEFAULT/log_config_append' : ensure => absent;
140       }
141     }
142
143   if $default_log_levels {
144     keystone_config {
145       'DEFAULT/default_log_levels' :
146         value => join(sort(join_keys_to_values($default_log_levels, '=')), ',');
147       }
148     }
149   else {
150     keystone_config {
151       'DEFAULT/default_log_levels' : ensure => absent;
152       }
153     }
154
155   if $publish_errors {
156     keystone_config {
157       'DEFAULT/publish_errors' : value => $publish_errors;
158       }
159     }
160   else {
161     keystone_config {
162       'DEFAULT/publish_errors' : ensure => absent;
163       }
164     }
165
166   if $fatal_deprecations {
167     keystone_config {
168       'DEFAULT/fatal_deprecations' : value => $fatal_deprecations;
169       }
170     }
171   else {
172     keystone_config {
173       'DEFAULT/fatal_deprecations' : ensure => absent;
174       }
175     }
176
177   if $instance_format {
178     keystone_config {
179       'DEFAULT/instance_format' : value => $instance_format;
180       }
181     }
182   else {
183     keystone_config {
184       'DEFAULT/instance_format' : ensure => absent;
185       }
186     }
187
188   if $instance_uuid_format {
189     keystone_config {
190       'DEFAULT/instance_uuid_format' : value => $instance_uuid_format;
191       }
192     }
193   else {
194     keystone_config {
195       'DEFAULT/instance_uuid_format' : ensure => absent;
196       }
197     }
198
199   if $log_date_format {
200     keystone_config {
201       'DEFAULT/log_date_format' : value => $log_date_format;
202       }
203     }
204   else {
205     keystone_config {
206       'DEFAULT/log_date_format' : ensure => absent;
207       }
208     }
209
210
211 }