Google cloud logging, using python with docker container -


i have simple python app , want use google cloud logging. use docker , run kubernetes.

how can send logs google cloud logging?

import time import logging  def main():     logging.basicconfig()     logging.getlogger().setlevel(logging.info)     try:         while true:             logging.info('working...')             time.sleep(1)     except keyboardinterrupt:         logging.info('stopped working')         pass;  if __name__ == '__main__':     main() 

if configure logger write stdout, kubernetes automatically send google cloud logging you.

otherwise you'll have use sidecar container collect logs , upload them you, in this example.


Comments