Sample example AWS cloudwatch time formats

The common datetime_format codes are listed below. You can also use

any datetime_format codes supported by Python, datetime.strptime(). The

timezone offset (%z) is also supported even though it’s not supported

until python 3.2, [+-]HHMM without colon(:). For more information, see

strftime() and strptime() Behavior.

%y: Year without century as a zero-padded decimal                                 number. 00, 01, …, 99                                                                                       

%Y: Year with century as a decimal number.1970,                                 1988, 2001, 2013                                                                                      

%b: Month as locale’s abbreviated name. Jan, Feb,                                 …, Dec (en_US);                                                                                       

%B: Month as locale’s full name. January,                                 February, …, December (en_US);                                                                                       

%m: Month as a zero-padded decimal number. 01,                                 02, …, 12                                                                                     

%d: Day of the month as a zero-padded decimal                                 number. 01, 02, …, 31                                                                                      

%H: Hour (24-hour clock) as a zero-padded decimal                                 number. 00, 01, …, 23                                                                                   

%I: Hour (12-hour clock) as a zero-padded decimal                                 number. 01, 02, …, 12                                                                                     

%p: Locale’s equivalent of either AM or                                 PM.                                                                                     

%M: Minute as a zero-padded decimal number. 00,                                 01, …, 59                                                                                       

%S: Second as a zero-padded decimal number. 00,                                 01, …, 59                                                                                        

%f: Microsecond as a decimal number, zero-padded                                 on the left. 000000, …, 999999                                                                                       

%z: UTC offset in the form +HHMM or -HHMM. +0000,                                 -0400, +1030                  

%s: Epoch time in seconds                                                                            1333234800            

                                                                                          

Example formats:                                                         

04 Oct 2017 23:47:09,795  – ‘%d %b %Y %H:%M:%S,%f’

10.180.39.110 – – [29/Sep/2017:00:00:03 +0000] – ‘%d/%b/%Y:%H:%M:%S %Z’

2017-09-25 20:51:21.595 – ‘%Y-%m-%d %H:%M:%S.%f’

29 Sep 2017 00:41:19 – ‘%d %b %Y %H:%M:%S’

Sep 24, 2017 00:41:19 AM – ‘%b %d, %Y %I:%M:%S %p’

ISO8601: ‘%Y-%m-%dT%H:%M:%S%z’, e.g.  2014-02-20T05:20:20+0000                                                                                                                        

Log4j: ‘%d %b %Y %H:%M:%S’, e.g. 24 Jan 2014  05:00:00                                                            

Syslog: ‘%b %d %H:%M:%S’, e.g. Jan 23 20:59:29                                                            

Typical Ambari/log4j: ‘%Y-%m-%d %H:%M:%S,%f’, e.g. 2017-09-24 05:48:25,218

18/04/17 18:58:21 INFO ShutdownHookManager: Shutdown hook called

%y/%m/%d %H:%M:%S 

Leave a Reply