mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
ARI: Rotate log channels.
An http request can be sent to rotate a specified log channel. If the channel does not exist, an error response will be returned. The command "curl -v -u user:pass -X PUT 'http://localhost:8088 /ari/asterisk/logging/logChannelName/rotate'" can be run in the terminal to access this new functionality. * Added the ability to rotate log files through ARI ASTERISK-25252 Change-Id: Iaefa21cbbc1b29effb33004ee3d89c977e76ab01
This commit is contained in:
@@ -362,6 +362,61 @@ ari_validator ast_ari_validate_config_tuple_fn(void)
|
||||
return ast_ari_validate_config_tuple;
|
||||
}
|
||||
|
||||
int ast_ari_validate_log_channel(struct ast_json *json)
|
||||
{
|
||||
int res = 1;
|
||||
struct ast_json_iter *iter;
|
||||
int has_logging_levels = 0;
|
||||
int has_name = 0;
|
||||
|
||||
for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
|
||||
if (strcmp("logging_levels", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_logging_levels = 1;
|
||||
prop_is_valid = ast_ari_validate_list(
|
||||
ast_json_object_iter_value(iter),
|
||||
ast_ari_validate_string);
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel field logging_levels failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
|
||||
int prop_is_valid;
|
||||
has_name = 1;
|
||||
prop_is_valid = ast_ari_validate_string(
|
||||
ast_json_object_iter_value(iter));
|
||||
if (!prop_is_valid) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel field name failed validation\n");
|
||||
res = 0;
|
||||
}
|
||||
} else
|
||||
{
|
||||
ast_log(LOG_ERROR,
|
||||
"ARI LogChannel has undocumented field %s\n",
|
||||
ast_json_object_iter_key(iter));
|
||||
res = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_logging_levels) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel missing required field logging_levels\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
if (!has_name) {
|
||||
ast_log(LOG_ERROR, "ARI LogChannel missing required field name\n");
|
||||
res = 0;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
ari_validator ast_ari_validate_log_channel_fn(void)
|
||||
{
|
||||
return ast_ari_validate_log_channel;
|
||||
}
|
||||
|
||||
int ast_ari_validate_module(struct ast_json *json)
|
||||
{
|
||||
int res = 1;
|
||||
|
Reference in New Issue
Block a user