How to avoid double writing when publishing RDS logs to Cloudwatch Logs.

0

I am publishing MySQL slow-query logs to CloudWatch Logs. When I look at CloudwatchLog, I see two logs with the same log. The same log is ingested at different times.

$ aws logs get-log-events --log-group-name /aws/rds/instance/db/slowquery --log-stream-name db
...
    "events": [
        {
            "ingestionTime": 1660018515125,
            "timestamp": 1660018510972,
            "message": "# Time: 2022-08-09T04:15:10.972506Z\n# User@Host: user[user] @  []  Id: 158209\n..."
        },
        {
            "ingestionTime": 1660021205551,
            "timestamp": 1660018510972,
            "message": "# Time: 2022-08-09T04:15:10.972506Z\n# User@Host: user[user] @  []  Id: 158209\n..."
        },
[5] pry(main)> Time.at 1660018515.125
=> 2022-08-09 13:15:15 +0900
[6] pry(main)> Time.at 1660021205.551
=> 2022-08-09 14:00:05 +0900

It sends once at 13:15 and again at 14:00 with the same log. I think RDS is probably sending twice from the same file, which setting should I change?

Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen