Skip to content

Commit

Permalink
Merge pull request #481 from mozilla-iam/gcp_logging
Browse files Browse the repository at this point in the history
Enable gcp cloud logging
  • Loading branch information
dividehex committed Oct 17, 2023
2 parents e8913ac + b5310d6 commit 7b2a8b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dashboard/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SSO Dashboard App File."""
import google.cloud.logging
import json
import logging.config
import mimetypes
Expand Down Expand Up @@ -38,6 +39,7 @@
from dashboard.models.alert import Rules
from dashboard.models.tile import S3Transfer

from google.cloud.logging_v2.handlers import CloudLoggingHandler

logging.basicConfig(level=logging.DEBUG)

Expand All @@ -46,7 +48,11 @@
config_dict = yaml.safe_load(config_yml)
logging.config.dictConfig(config_dict)

gcp_logger_client = google.cloud.logging.Client()
gcp_handler = CloudLoggingHandler(gcp_logger_client)

logger = logging.getLogger("sso-dashboard")
logger.addHandler(gcp_handler)

app = Flask(__name__)
everett_config = get_config()
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Flask-pyoidc==3.13.0
flask-talisman==1.0.0
future==0.18.3
gevent==22.10.2
google-cloud-logging>=3.0.0
greenlet==2.0.2
gunicorn==20.1.0
identify==2.5.24
Expand Down

0 comments on commit 7b2a8b8

Please sign in to comment.