Replies: 11 comments
-
Thanks for opening your first issue here! Be sure to follow the issue template! |
Beta Was this translation helpful? Give feedback.
-
@potiuk I think I can try this one. My current understanding of the code + changes required:
Let me know if thats the approach. Can do the changes accordingly. |
Beta Was this translation helpful? Give feedback.
-
Hard to say. I am not expert on cloud-watch - but maybe others can help :) |
Beta Was this translation helpful? Give feedback.
-
Was curious more from a config standpoint. I believe the way to specify/override the default config is from airflow_local_settings.py. Will create a PR. Will make it easier to iterate on it. If anyone else gets to reviewing the approach, please let me know :) |
Beta Was this translation helpful? Give feedback.
-
Hey folks, watchtower does an idempotent create for the log group as you can see here.. If the log group already exists it will catch that error and ignore it silently. The issue you actually hit is an authentication issue, as seen in your exception message:
The role you're using doesn't have permission for the log group creation. It's worth double checking that role has all the required permissions for cloudwatch logging (creating groups, streams and uploading records). |
Beta Was this translation helpful? Give feedback.
-
Given the discussion in 19022, I think this issue can be resolved/closed? |
Beta Was this translation helpful? Give feedback.
-
Hey folks, sorry that I didn't respond for that long. I also figured out that this looks like an authentication problem but even with all privileges given to airflow the error still occurred. I was wondering if airflow maybe tries to create the log group inside the log stream. The error |
Beta Was this translation helpful? Give feedback.
-
What I'm quite sure of is that the issue is constrained to your configuration. Otherwise we'd have this exception for all users with logging to cloudwatch. I don't think the boto3 api would return an authentication issue if the log group name was formatted incorrectly. The airflow-service-account-role you're using likely is still missing the correct policies. |
Beta Was this translation helpful? Give feedback.
-
I am facing the very same issue on Airflow
The Cloudwatch log group is already created using Cloudformation and the policies accordingly: Resources:
DagsLogs:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub airflow-v2-${Stage}-dags
TaskRole:
Type: AWS::IAM::Role
Properties:
Policies:
- PolicyName: !Sub ${EnvironmentName}-logs-dags-${Stage}
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
Resource:
- !GetAtt DagsLogs.Arn
The Airflow cofiguration variables are the following: Environment:
- Name: AIRFLOW_CONN_LOGS_CLOUDWATCH
Value: !Sub 'cloudwatch://cloudwatch?aws_account_id=XXXXXXX&role_arn=arn%3Aaws%3Aiam%3A%3A919107267526%3Arole%2Fairflow-ecs-task-role-${Stage}'
- Name: AIRFLOW__LOGGING__REMOTE_LOGGING
Value: 'true'
- Name: AIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDER
Value: !Sub "cloudwatch://arn:aws:logs:eu-central-1:XXXXXXX:log-group:airflow-v2-${Stage}-dags"
- Name: AIRFLOW__LOGGING__REMOTE_LOG_CONN_ID
Value: logs_cloudwatch Adding |
Beta Was this translation helpful? Give feedback.
-
Based on discussion in #19022 i'm converting this to github discussion |
Beta Was this translation helpful? Give feedback.
-
Raise error_class(parsed_response, operation_name) got the same error for an already working application after a EC2 reboot. And it's true the role has full access to cloudwatch |
Beta Was this translation helpful? Give feedback.
-
Apache Airflow version
2.1.2
Operating System
Ubuntu Docker
Versions of Apache Airflow Providers
apache-airflow-providers-amazon==2.0.0
apache-airflow-providers-celery==2.0.0
apache-airflow-providers-cncf-kubernetes==2.0.0
apache-airflow-providers-docker==2.0.0
apache-airflow-providers-elasticsearch==2.0.2
apache-airflow-providers-ftp==2.0.0
apache-airflow-providers-google==4.0.0
apache-airflow-providers-grpc==2.0.0
apache-airflow-providers-hashicorp==2.0.0
apache-airflow-providers-http==2.0.0
apache-airflow-providers-imap==2.0.0
apache-airflow-providers-microsoft-azure==3.0.0
apache-airflow-providers-mysql==2.0.0
apache-airflow-providers-neo4j==2.0.0
apache-airflow-providers-postgres==2.0.0
apache-airflow-providers-redis==2.0.0
apache-airflow-providers-sendgrid==2.0.0
apache-airflow-providers-sftp==2.0.0
apache-airflow-providers-slack==4.0.0
apache-airflow-providers-sqlite==2.0.0
apache-airflow-providers-ssh==2.0.0
Deployment
Official Apache Airflow Helm Chart
Deployment details
The log group is already created in Terraform.
What happened
What you expected to happen
I would expect Airflow to create a stream and write the logs, not to create a log-group inside a log-group.
How to reproduce
Run any dag with the chart config.
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions