christiangda / ansible-role-amazon-cloudwatch-agent

Ansible Role for Amazon Cloudwatch Agent
GNU General Public License v3.0
60 stars 45 forks source link

InvalidSequenceTokenException #21

Closed adespain closed 4 years ago

adespain commented 4 years ago
2020-02-25T00:42:26Z W! cloudwatchlogs: InvalidSequenceTokenException, will search the next token and retry the request: , original error: "InvalidSequenceTokenException: \n{\n  ExpectedSequenceToken: \"49604089713449685814714071033227496902314801060141903714\"\n}", {
  ExpectedSequenceToken: "49604089713449685814714071033227496902314801060141903714"

Here is my config:

cwa_agent_mode: "ec2"
cwa_aws_region: "us-west-2"

cwa_conf_json_file_content:
  agent:
    metrics_collection_interval: 60
    region: us-west-2
    logfile: "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
    debug: false
  metrics:
    metrics_collected:
      cpu:
        resources:
          - "*"
        measurement:
          - name: cpu_usage_idle
            rename: CPU_USAGE_IDLE
            unit: Percent
          - name: cpu_usage_nice
            unit: Percent
          - cpu_usage_guest
        totalcpu: false
        metrics_collection_interval: 10
        append_dimensions:
          test: test1
          date: "2017-10-01"
      netstat:
        measurement:
          - tcp_established
          - tcp_syn_sent
          - tcp_close
        metrics_collection_interval: 60
      processes:
        measurement:
          - running
          - sleeping
          - dead
    append_dimensions:
      ImageId: "${!aws:ImageId}"
      InstanceId: "${!aws:InstanceId}"
      InstanceType: "${!aws:InstanceType}"
      AutoScalingGroupName: "${!aws:AutoScalingGroupName}"
    aggregation_dimensions:
      - - AutoScalingGroupName
      - - InstanceId
        - InstanceType
      - []
  logs:
    logs_collected:
      files:
        collect_list:
          - file_path: "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
            log_group_name: amazon-cloudwatch-agent.log
            log_stream_name: zionspf2-stage-amazon-cloudwatch-agent.log
            timezone: UTC
          - file_path: "/var/log/nginx/access.log"
            log_group_name: Web-access-logs-test
            log_stream_name: zionspf2-stage-access.log
            timezone: Local
    log_stream_name: zionspf2_log_stream
    force_flush_interval: 15

The log stream for zionspf2-stage-amazon-cloudwatch-agent.log gets created but the other one zionspf2-stage-access.log does not... Can anyone tell me what I am doing wrong?

christiangda commented 4 years ago

Hi @adespain,

This is not a problem in the Ansible role, it looks like a problem in your ec2 role permission on in your credentials permissions.

https://aws.amazon.com/premiumsupport/knowledge-center/push-log-data-cloudwatch-awslogs/