0

我一直在爲此奮鬥了好幾個小時,這讓我發瘋。我安裝了日誌代理並正確設置它。AWS日誌中出現無效的令牌錯誤

我可以通過這個命令訪問實例。 eb ssh

然而,當我運行命令sudo service awslogs restart,我得到奇怪的錯誤,如

2017-06-12 16:31:41,899 - cwlogs.push.publisher - WARNING - 31909 - 
Thread-7 - Caught exception: An error occurred 
(UnrecognizedClientException) when calling the PutLogEvents operation: 
The security token included in the request is invalid. 

2017-06-12 16:31:41,899 - cwlogs.threads - ERROR - 31909 - Thread-7 - 
Exception caught in <EventBatchPublisher(Thread-7, started daemon 
140242458298112)> 

Traceback (most recent call last): 

我已經改變了憑據多次,都沒有用。

另外,我得到這個錯誤在awslogs.log文件:

2017-06-12 16:31:40,862 - cwlogs.push.reader - 
WARNING - 31909 - Thread-8 - Fall back to previous event time: 
{'timestamp': 1497246644000, 'start_position': 7142L, 'end_position': 
7246L}, previousEventTime: 1497246644000, reason: timestamp could not 
be parsed from message. 

我使用以下格式:

[/var/log/tomcat8/catalina.out] 
datetime_format = %d-%b-%Y %H:%M:%S 
file = /var/log/tomcat8/catalina.out 
buffer_duration = 5000 
log_stream_name = {instance_id} 
initial_position = start_of_file 
log_group_name = Catalina 

在這一點上的任何幫助將不勝感激。

+0

您如何向CloudWatch日誌代理(awslogs)提供憑據?理想情況下,您的實例將具有與之關聯的IAM角色,並且IAM角色將具有允許各種日誌記錄操作的策略(請參閱http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance上的策略文檔的.html)。 – jarmod

+0

嗨,我修好了。感謝@saopayne。 – Ade

回答

0

請在「aws configure」命令中附加「sudo」。

+0

工作正常!謝謝。 – Ade

相關問題