Amazon Polly: Statistics of audio files

0

We started using Amazon Polly and created the first audio files (.mp3) of articles for our website. The .mp3 files remain in the Amazon Polly bucket (we use the url). We wanted to know if, with Amazon Polly, it is possible to see how many times each audio file has been listened to. Thanks

  • Can you share how exactly are you accessing those mp3s? I don't recall Polly externalizing any bucket - do you mean pre-signed urls? If yes, then those invoke synthesis each time when visited, which should be visible in cloudtrail (look for polly.amazonaws.com as Event source). But I don't see a way to group them by url. See documentation here: https://docs.aws.amazon.com/polly/latest/dg/sec-logging.html

  • Hi TB, I insert in the player of the website a link like this: https://name-bucket.s3.eu-central-1.amazonaws.com/folder_name/.name_file.mp3 If you have any recommendations, I'd appreciate it. I still haven't been able to find a solution. Thanks

  • Ok, so it looks like the issue is not connected to Polly, which looses any connection with the mp3 after its synthesis. @igsalvar's answers about S3 logging might be the right solution to you.

asked a year ago283 views
3 Answers
1

For that you will need to access the Server access logging of the S3 bucket where your are storing your files. For details, see Enabling Amazon S3 server access logging.

This feature provides detailed records for the requests that are made to an Amazon S3 bucket, so you will be able to see how many times an object in that bucket is accessed.

You can also use Amazon Athena to analyse this logs. Analyse my Amazon S3 server access logs using Athena.

profile pictureAWS
answered a year ago
0

Thanks a lot for the reply igsalvar. Following your instructions, I activated Server access logging of the S3 bucket. With Athena, I created a database and table following the directions. Now I need help to create a query that allows me to obtain the number of views of .mp3 files. Can you help me? Thanks again

answered a year ago
  • Let me know if the query below solves your issue or do you need any more help.

0

You can use this query to visualize all the operations done in a specific object key:

SELECT count(*) as AccessNumber
FROM s3_accesslogs_db.mybucket_logs
WHERE key = 'keyprefix/keyobject.file' 
AND operation = 'REST.GET.OBJECT' ;

Just change the second line ('s3_accesslogs_db.mybucket_logs') for your database name and the third line ('keyprefix/keyobject.file') for the key of your object.

You could also include additional conditional lines to that query to filter by IP or by a specific time frame. Example:

WHERE remoteIP='1.2.3.4' AND 
parse_datetime(requestdatetime,'dd/MMM/yyyy:HH:mm:ss Z')
BETWEEN parse_datetime('2021-07-01','yyyy-MM-dd')
AND parse_datetime('2021-08-01','yyyy-MM-dd');
profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions