From 0440d7d632fa1732a8f7109fe9021a22a7a6b6a0 Mon Sep 17 00:00:00 2001 From: Thibault S <48209914+thibaults-centreon@users.noreply.github.com> Date: Fri, 30 Oct 2020 15:27:38 +0100 Subject: [PATCH] fix(mode): timeframe value should not be null (#2312) The graylog API consider requests with undef parameters values as 0. So we'd better ensure that the timeframe value is valid when the option is set --- apps/graylog/restapi/mode/query.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/graylog/restapi/mode/query.pm b/apps/graylog/restapi/mode/query.pm index a96b046ab..4dbd1b7d0 100644 --- a/apps/graylog/restapi/mode/query.pm +++ b/apps/graylog/restapi/mode/query.pm @@ -65,6 +65,11 @@ sub check_options { $self->{output}->add_option_msg(short_msg => 'Please set --query option.'); $self->{output}->option_exit(); } + + if (defined($self->{option_results}->{timeframe}) && $self->{option_results}->{timeframe} eq '') { + $self->{output}->add_option_msg(short_msg => 'Please set --timeframe value.'); + $self->{output}->option_exit(); + } } sub manage_selection {