如何在node.js中的amazon s3中获取存储桶中任何资源的最后访问日期? [英] How to get the last access date of any resource in a bucket in amazon s3 in node.js?

查看:77
本文介绍了如何在node.js中的amazon s3中获取存储桶中任何资源的最后访问日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取存储桶中资源的最后访问日期.但是找不到与之相关的任何东西.我试图获取存储桶的所有访问日志,然后解析日志文件以检查是否访问了资源.

I am trying to get the last access date of a resource in a bucket. But not able find anything related to it. I tried to fetch all the access logs for a bucket and parsed the logs files to check if a resource is accessed.

这是一种非常复杂的方法.在

This is a very complex approach. In the

s3.listObjects 我正在获取以下对象:-

s3.listObjects I am getting the below object:-

 { Key: '_636579271588176973_951622.json',
       LastModified: 2018-08-02T08:31:29.000Z,
       ETag: '"c348574fabf83d603984a60983add161"',
       Size: 32172,
       StorageClass: 'STANDARD',
       Owner: [Object] },

推荐答案

S3仅仅是AWS的对象存储解决方案,因此不包含文件访问时间等信息.

S3 is merely an object storage solution from AWS and so doesn't hold information like file access time, etc.

一如既往,有解决方法来实现这一目标,

As always there are workarounds to achieve this,

  • You may setup CloudTrail to get last access date to a resource based on resource type. Read more here.
  • You may make use of Server Access Logging on your bucket, and parse the logs to extract your last access date for the object. Read more here.

这篇关于如何在node.js中的amazon s3中获取存储桶中任何资源的最后访问日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆