0

일부 코드에서 로그 이벤트를 게시하는 데 boto3을 사용하고 있습니다. 결과는 0 바이트가 저장되었음을 보여줍니다. 다른 모든 항목은 유효하고 다음 sequenceToken 및 생성 시간은 표시되지만 로그에는 이벤트가 없습니다. 보내는 메시지는 단순한 message = "test"입니다. 이 함수를 호출 할 때 나타납니다, 로그 스트림 형식의 예기치 않은 결과가 반환됩니다. 아무도이 원인이 무엇인지 압니까? 기대 된 문서에서Cloudwatch boto3 put_log_events가 잘못된 반환

{'storedBytes': 0, 'creationTime': 1481640079355, 
'uploadSequenceToken': 'validtoken', 
'logStreamName': 'test_stream_1', 
'lastIngestionTime': 1481640079447, 
'arn': 'arn:aws:logs:us-east-1:[aws_id]:log-group:test_group:log-stream:test_stream_1'} 

:

{ 
    'nextSequenceToken': 'string', 
    'rejectedLogEventsInfo': { 
     'tooNewLogEventStartIndex': 123, 
     'tooOldLogEventEndIndex': 123, 
     'expiredLogEventEndIndex': 123 
    } 
} 

답변

1

잘못된 결과는 시간이었다 오류가 있었다 빨간색 herring-했다

kwargs = {'logGroupName': self.log_group_name, 
      'logStreamName': self.log_stream_name, 
      'logEvents': [ 
        { 
         'timestamp': ts, 
         'message': message 
        }, 
       ]} 

     token = self.get_seq_token() 
     if token: 
      print 'token:' + token 
      kwargs.update({'sequenceToken': token}) 

     response = self.client.put_log_events(**kwargs) 

결과는 로그 스트림 것 같다 너무 오래 전에. 유닉스 시간을 1000 배로 늘려야한다.

ts = int(time.time()*1000) 

관련 항목 : amazon CloudWatchLogs putLogEvents