Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding in debugging statements #7

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/logstash/inputs/cloudwatch_logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ def register
@logger.debug("Registering cloudwatch_logs input", :log_group => @log_group)
settings = defined?(LogStash::SETTINGS) ? LogStash::SETTINGS : nil
@sincedb = {}

@logger.info("version 1.1.1")
check_start_position_validity
@cloudwatch = Aws::CloudWatchLogs::Client.new(aws_options_hash)
@tag_cache = {}
@logger.info("starting Cache")
Aws::ConfigService::Client.new(aws_options_hash)

if @sincedb_path.nil?
Expand Down Expand Up @@ -140,7 +141,7 @@ def find_log_groups
log_groups = @cloudwatch.describe_log_groups(log_group_name_prefix: group, next_token: next_token)
groups += log_groups.log_groups.map {|n| n.log_group_name}
next_token = log_groups.next_token
@logger.debug("found #{log_groups.log_groups.length} log groups matching prefix #{group}")
@logger.info("found #{log_groups.log_groups.length} log groups matching prefix #{group}")
break if next_token.nil?
end
end
Expand Down Expand Up @@ -217,7 +218,7 @@ def fetch_tags_from_cloudwatch(log_group_name)
tag_params = { log_group_name: log_group_name}
response = @cloudwatch.list_tags_log_group(tag_params)
tags = response.tags

@logger.info("fetching tags for log_group #{log_group_name}")
tags.clone.each do |key, value|
key_without_spaces = key.to_s.gsub(/[[:space:]]/, "")
if not tags.key?(key_without_spaces)
Expand Down