Code Monkey home page Code Monkey logo

Comments (4)

markuman avatar markuman commented on August 23, 2024

The existing policy needs to be append.

https://github.com/mattclay/aws-terminator/blob/master/aws/policy/application-services.yaml#L161

The integration tests needs also

  • logs:DescribeMetricFilter
  • logs:PutMetricFilter
  • logs:DeleteMetricFilter

from aws-terminator.

markuman avatar markuman commented on August 23, 2024

@jillr @mattclay
step 1 markuman@1846b9a

but I'm not sure if this is necessary. If I delete a log group, the applied metric filter will automatically removed too?

from aws-terminator.

jillr avatar jillr commented on August 23, 2024

@markuman That makes sense, I just don't see anything in the boto or api docs to that effect so I assumed metrics would need a class to do clean up. I'll probably need to just experiment with it to confirm metrics clean up properly with log groups when I review the PR. Thanks.

from aws-terminator.

markuman avatar markuman commented on August 23, 2024

Sorry for the late reply, currently my time is rare with a newborne.

---
- hosts: localhost
  connection: local
  gather_facts: False

  tasks:
    - name: create new cloudwatch log group
      cloudwatchlogs_log_group:
        log_group_name: "ansible_test_group"
        retention: 1

    - name: apply metric filter on cwl group
      cloudwatchlogs_log_group_metric_filter:
        log_group_name: ansible_test_group
        filter_name: ansible_filter
        filter_pattern: "some pattern"
        state: present
        metric_transformation:
          metric_name: some_pattern_count
          metric_namespace: ansible_metrics
          metric_value: "1"

    - name: delete log group
      cloudwatchlogs_log_group:
        log_group_name: "ansible_test_group"
        state: absent

    - name: is it really gone?
      cloudwatchlogs_log_group:
        log_group_name: "ansible_test_group"
        state: absent

When I execute this:

PLAY [localhost] *********************************************************************************************************************************************************************

TASK [create new cloudwatch log group] ***********************************************************************************************************************************************
changed: [localhost]

TASK [apply metric filter on cwl group] **********************************************************************************************************************************************
changed: [localhost]

TASK [delete log group] **************************************************************************************************************************************************************
changed: [localhost]

TASK [is it really gone?] ************************************************************************************************************************************************************
ok: [localhost]

PLAY RECAP ***************************************************************************************************************************************************************************
localhost                  : ok=4    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

The log group is gone, and with it its metric filter.
So I'm not sure if the terminator class for CloudWatch Logs https://github.com/mattclay/aws-terminator/blob/master/aws/terminator/application_services.py#L30 is already sufficient?
@jillr @mattclay

from aws-terminator.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.