Skip to content

An endless stream of logs #9

@dmitrikozlov

Description

@dmitrikozlov

Here are steps I did:

(env) $pip install google_structlog
(env) $ pip freeze | grep log
django-request-logging==0.7.3
google-cloud-appengine-logging==1.3.0
google-cloud-audit-log==0.2.5
google-cloud-logging==1.15.1
google-structlog==43.12.0
python-json-logger==2.0.7
structlog==23.1.0
(env)python
Python 3.9.7 (default, Oct 13 2021, 06:44:56)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from google_structlog import getLogger
logger = getLogger()
logger.warn('Danger Will Robinson', source='Robot', target='Will Robinson', threat='Boredom')
Danger Will Robinson source=Robot target=Will Robinson threat=Boredom
Danger Will Robinson source=Robot target=Will Robinson threat=Boredom
Making request: POST https://oauth2.googleapis.com/token
Starting new HTTPS connection (1): oauth2.googleapis.com:443
https://oauth2.googleapis.com:443 "POST /token HTTP/1.1" 200 None
Submitted 1 logs
Submitted 4 logs
Submitted 1 logs
Submitted 1 logs
Submitted 1 logs
Submitted 1 logs
Submitted 1 logs
Submitted 1 logs
...

In the GCP Logs I have now:
...
DEBUG 2023-04-20T02:16:28.754365Z Submitted 1 logs
DEBUG 2023-04-20T02:16:28.563122Z Submitted 4 logs
DEBUG 2023-04-20T02:16:28.344749Z Submitted 1 logs
DEBUG 2023-04-20T02:16:28.148500Z https://oauth2.googleapis.com:443 "POST /token HTTP/1.1" 200 None
DEBUG 2023-04-20T02:16:27.790729Z Starting new HTTPS connection (1): oauth2.googleapis.com:443
DEBUG 2023-04-20T02:16:27.642244Z Making request: POST https://oauth2.googleapis.com/token
WARNING 2023-04-20T02:16:27.068259Z Danger Will Robinson
{
"jsonPayload": {
"source": "Robot",
"target": "Will Robinson",
"message": "Danger Will Robinson",
"threat": "Boredom",
"python_logger": "main"
},
"timestamp": "2023-04-20T02:16:27.068259Z",
"severity": "WARNING",
"receiveTimestamp": "2023-04-20T02:16:28.298428623Z"
}

The original log was inserted and followed by a stream of "Submitted 1 logs" entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions