class Dogapi::V1::AwsLogsService
AwsLogsService
for user interaction with AWS configs.
Constants
- API_VERSION
Public Instance Methods
Create an AWS integration :config => Hash: integration config. config = {
:account_id => '<AWS_ACCOUNT>', :lambda_arn => '<LAMBDA_ARN>'
}
dog = Dogapi::Client.new
(api_key, app_key)
puts dog.aws_logs_add_lambda(config)
# File lib/dogapi/v1/aws_logs.rb 30 def aws_logs_add_lambda(config) 31 request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs", nil, config, true) 32 end
contents of config should be >>> :account_id => '<AWS_ACCOUNT_ID>' >>> :lambda_arn => '<AWS_LAMBDA_ARN>'
# File lib/dogapi/v1/aws_logs.rb 81 def aws_logs_check_lambda(config) 82 request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs/check_async", nil, config, true) 83 end
contents of config should be :account_id => '<AWS_ACCOUNT_ID>' :services => ['s3', 'elb', 'elbv2', 'cloudfront', 'redshift', 'lambda']
# File lib/dogapi/v1/aws_logs.rb 98 def aws_logs_check_services(config) 99 request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs/services_async", nil, config, true) 100 end
Delete an AWS Logs integration :config => Hash: integration config. config = {
:account_id => '<AWS_ACCOUNT>', :lambda_arn => '<LAMBDA_ARN>'
}
dog = Dogapi::Client.new
(api_key, app_key)
puts dog.aws_logs_integration_delete(config)
# File lib/dogapi/v1/aws_logs.rb 63 def aws_logs_integration_delete(config) 64 request(Net::HTTP::Delete, "/api/#{API_VERSION}/integration/aws/logs", nil, config, true) 65 end
List all Datadog-AWS Logs integrations configured in your Datadog account.
# File lib/dogapi/v1/aws_logs.rb 35 def aws_logs_integrations_list 36 request(Net::HTTP::Get, "/api/#{API_VERSION}/integration/aws/logs", nil, nil, false) 37 end
Get the list of current AWS services for which Datadog offers automatic log collection. Use returned service IDs with the services parameter for the Enable an AWS service log collection API endpoint.
# File lib/dogapi/v1/aws_logs.rb 16 def aws_logs_list_services 17 request(Net::HTTP::Get, "/api/#{API_VERSION}/integration/aws/logs/services", nil, nil, false) 18 end
Enable automatic log collection for a list of services. This should be run after running 'aws_logs_add_lambda' to save the config. config = {
:account_id => '<AWS_ACCOUNT>', :services => ['s3', 'elb', 'elbv2', 'cloudfront', 'redshift', 'lambda']
}
dog = Dogapi::Client.new
(api_key, app_key)
puts dog.aws_logs_save_services(config)
# File lib/dogapi/v1/aws_logs.rb 49 def aws_logs_save_services(config) 50 request(Net::HTTP::Post, "/api/#{API_VERSION}/integration/aws/logs/services", nil, config, true) 51 end