Skip to content

Commit c07f091

Browse files
committed
fix: include cloud_run_job in /logs command query to catch cron job errors
1 parent 89ff083 commit c07f091

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

handlers/admin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ async def sugerirNoticia(update: Update, context: ContextTypes.DEFAULT_TYPE):
6666

6767
async def get_logs(update: Update, context: ContextTypes.DEFAULT_TYPE):
6868
user_id = update.effective_user.id
69-
if user_id not in admin_ids:
69+
if user_id not in admin_ids and str(user_id) not in admin_ids:
70+
logger.warning(f"Unauthorized user {user_id} tried to access /logs")
7071
return
7172

7273
try:
@@ -77,7 +78,7 @@ async def get_logs(update: Update, context: ContextTypes.DEFAULT_TYPE):
7778
await update.message.reply_text("Buscando errores en Google Cloud Logging...")
7879
client = gcp_logging.Client()
7980

80-
filter_str = 'resource.type="cloud_run_revision" AND severity>=ERROR AND resource.labels.service_name="dcubabot"'
81+
filter_str = 'severity>=ERROR AND (resource.type="cloud_run_revision" OR resource.type="cloud_run_job")'
8182
entries = client.list_entries(filter_=filter_str, order_by=gcp_logging.DESCENDING, max_results=50)
8283

8384
log_msgs = []

0 commit comments

Comments
 (0)