Functionality:
- Triggers when a new document is added to the s3.
- Reads the log file, and creates an index of the document.
- Index contains:
- key: timestamp (HH:MM:SS)
- value: (file name, start btye, end byte)
- New Index is created for each date.
- Index is stored as pickle file in s3 bucket.
- Lambda function receives the request and decodes the Protobuf object.
- Lambda function uses the Protobuf object to compute the result.
- Lambda function looks up the Date TimeStamp in the index(pickle file) and gets the LogFileName, startByte and endByte.
- If the Date TimeStamp is found in the pickle file, it reads the LogFile from S3 and returns the result - True (as protobuf object).
- If the Date TimeStamp is not found in the pickle file, it returns False (as protobuf object).
- Supports the following HTTP methods: GET, POST
- Supports the following HTTP headers:
- Content-Type: application/json
- Requires the following input parameters:
- date: YYYY-MM-DD
- timeStamp: HH:MM:SS
- window: integer value in minutes
- Checks LogFile Index to get the list of files, and starting byte position for the given timestamp within the file.
- Loads the file from S3 bucket, from the starting byte position.
- Checks for all pattern matches in the logfiles in the specified window.
- Converts the matches into md5 hashes and returns it to client.
- If there is no logs available for specified window, it returns 404 with message.
Read this article to deal with dependencies, and requirements for gRPC lambda.
Useful AWS Article: https://docs.aws.amazon.com/lambda/latest/dg/python-package.html