GreenGrass logging format of date time

0

does anyone know what the date/time format is called that is used in greengrass

the 2022-06-15T08:26:23.770Z in for example /greengrass/v2/logs/greengrass.log

2022-06-15T08:26:23.770Z [INFO] (Thread-5) com.aws.greengrass.shadowmanager.ipc.UpdateThingShadowRequestHandler: Successfully updated shadow. {service-name=au.com.blabla.gg_shadow_config, thing name=smartdvr-1423019132001, shadow name=config1, local-version=20102}

I'm trying to match the greengrass log format using normal python logging.Formatter for some non-greengrass related logfiles, but use 1 logfile_upload component to do one-shot logfile request,response to CloudWatch, and it would be easier if they are all in the same format.

logging.Formatter.formatTime = (lambda self, record, datefmt=None: datetime.datetime.fromtimestamp(record.created, datetime.timezone.utc).astimezone().isoformat(sep="T",timespec="milliseconds"))

gets very close 2021-08-05T22:43:02.985614+00:00 Something logged here but +00:00 needs to be replaced with Z

https://en.wikipedia.org/wiki/ISO_8601 describes both the +00:00 and the Z , so it doesn't help me with finding examples

clogwog
질문됨 2년 전210회 조회
1개 답변
0
수락된 답변
fh = RotatingFileHandler('/data/logs/gg_upload_logs.log', maxBytes=80000, backupCount=4)
formatter = logging.Formatter( fmt='%(asctime)s.%(msecs)03dZ %(message)s', datefmt='%Y-%m-%dT%H:%M:%S')
fh.setFormatter(formatter)
clogwog
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠