diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9cccfaf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,119 @@ +name: Upload new release +on: + release: + types: [published] + +jobs: + build_function: + name: Build function + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get integraion + id: integration-receiver + run: | + integration=$(echo "${{ github.event.release.tag_name }}" | cut -d- -f2) + echo "integration=${integration}" >> "$GITHUB_ENV" + - name: Get version clean + id: version-receiver-without + run: | + version=$(echo "${{ github.event.release.tag_name }}" | cut -d- -f1) + version_without=$(echo ${version:1}) + echo "version_without=${version_without}" >> "$GITHUB_ENV" + + + - name: Zip Folder + run: | + if [[ "${{ env.integration }}" = "CloudWatch" ]]; then + cd python3/cloudwatch + make + echo "release_file_path=python3/cloudwatch/dist/logzio-cloudwatch-log-shipper.zip" >> "$GITHUB_ENV" + else + cd python3/kinesis + make + echo "release_file_path=python3/kinesis/dist/logzio-kinesis-log-shipper.zip" >> "$GITHUB_ENV" + fi + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: ${{ env.release_file_path }} + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_GIT }} + upload_to_buckets: + name: Upload to S3 buckets + runs-on: ubuntu-latest + needs: build_function + strategy: + matrix: + aws_region: + - 'us-east-1' + - 'us-east-2' + - 'us-west-1' + - 'us-west-2' + - 'eu-central-1' + - 'eu-north-1' + - 'eu-west-1' + - 'eu-west-2' + - 'eu-west-3' + - 'sa-east-1' + - 'ap-northeast-1' + - 'ap-northeast-2' + - 'ap-northeast-3' + - 'ap-south-1' + - 'ap-southeast-1' + - 'ap-southeast-2' + - 'ca-central-1' + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Receive integraion + id: integration-receiver + run: | + integration=$(echo "${{ github.event.release.tag_name }}" | cut -d- -f2) + echo "integration=${integration}" >> "$GITHUB_ENV" + - name: Receive version clean + id: version-receiver-without + run: | + version=$(echo "${{ github.event.release.tag_name }}" | cut -d- -f1) + version_without=$(echo ${version:1}) + echo "version_without=${version_without}" >> "$GITHUB_ENV" + - name: download zip + run: | + if [[ "${{ env.integration }}" = "CloudWatch" ]]; then + wget -c https://github.com/resdenia/github-action-aws-python/releases/download/${{ github.event.release.tag_name }}/logzio-cloudwatch-log-shipper.zip -O logzio-cloudwatch.zip + else + wget -c https://github.com/resdenia/github-action-aws-python/releases/download/${{ github.event.release.tag_name }}/logzio-kinesis-log-shipper.zip -O logzio-kinesis.zip + fi + shell: bash + - name: create new version + run: | + if [[ "${{ env.integration }}" = "CloudWatch" ]]; then + cp ./python3/cloudwatch/sam-template.yaml ./sam-template-${{ matrix.aws_region }}.yaml + else + cp ./python3/kinesis/sam-template.yaml ./sam-template-${{ matrix.aws_region }}.yaml + fi + sed -i "s/<>/${{ env.version_without }}/" "./sam-template-${{ matrix.aws_region }}.yaml" + sed -i "s/<>/${{ matrix.aws_region }}/" "./sam-template-${{ matrix.aws_region }}.yaml" + shell: bash + - name: Upload to aws + run: | + + sudo apt-get update + sudo apt-get install awscli + aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY }} + aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_KEY }} + aws configure set region ${{ matrix.aws_region }} + if [[ "${{ env.integration }}" = "CloudWatch" ]]; then + aws s3 cp ./sam-template-${{ matrix.aws_region }}.yaml s3://logzio-aws-integrations-${{ matrix.aws_region }}/cloudwatch-auto-deployment/${{ env.version_without }}/sam-template.yaml --acl public-read + aws s3 cp ./logzio-cloudwatch.zip s3://logzio-aws-integrations-${{ matrix.aws_region }}/cloudwatch-auto-deployment/${{ env.version_without }}/logzio-cloudwatch.zip --acl public-read + else + aws s3 cp ./sam-template-${{ matrix.aws_region }}.yaml s3://logzio-aws-integrations-${{ matrix.aws_region }}/aws-kinesis/${{ env.version_without }}/auto-deployment.yaml --acl public-read + aws s3 cp ./logzio-kinesis.zip s3://logzio-aws-integrations-${{ matrix.aws_region }}/aws-kinesis/${{ env.version_without }}/logzio-kinesis.zip --acl public-read + fi + shell: bash + - name: Clean + run: | + rm ./sam-template-${{ matrix.aws_region }}.yaml + rm ./function.zip diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..656b796 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.prettierignore \ No newline at end of file diff --git a/python3/cloudwatch/README.md b/python3/cloudwatch/README.md index 29c29bd..318b4ea 100644 --- a/python3/cloudwatch/README.md +++ b/python3/cloudwatch/README.md @@ -74,23 +74,23 @@ To deploy this project, click the button that matches the region you wish to dep | REGION | DEPLOYMENT | |------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `us-east-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-east-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `us-east-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-east-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `us-west-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-west-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `us-west-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-west-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `eu-central-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-central-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `eu-north-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-north-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `eu-west-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-west-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `eu-west-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-west-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `eu-west-3` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-west-3.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `sa-east-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=sa-east-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-sa-east-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `ca-central-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ca-central-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ca-central-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `ap-northeast-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-northeast-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `ap-northeast-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-northeast-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `ap-northeast-3` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-3#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-northeast-3.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `ap-south-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-south-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `ap-southeast-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-southeast-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | -| `ap-southeast-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-southeast-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.0.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `us-east-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-east-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `us-east-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-east-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `us-west-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-west-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `us-west-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-us-west-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `eu-central-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-central-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `eu-north-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-north-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `eu-west-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-west-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `eu-west-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-west-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `eu-west-3` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/create/review?templateURL=https://logzio-aws-integrations-eu-west-3.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `sa-east-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=sa-east-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-sa-east-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `ca-central-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ca-central-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ca-central-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `ap-northeast-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-northeast-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `ap-northeast-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-northeast-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `ap-northeast-3` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-3#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-northeast-3.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `ap-south-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-south-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `ap-southeast-1` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-southeast-1.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | +| `ap-southeast-2` | [![Deploy to AWS](https://dytvr9ot2sszz.cloudfront.net/logz-docs/lights/LightS-button.png)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/create/review?templateURL=https://logzio-aws-integrations-ap-southeast-2.s3.amazonaws.com/cloudwatch-auto-deployment/1.1.0/sam-template.yaml&stackName=logzio-cloudwatch-shipper) | #### 2. Specify stack details @@ -116,6 +116,8 @@ Give your logs some time to get from your system to ours, and then open [Kibana] If you still don't see your logs, see [log shipping troubleshooting](https://docs.logz.io/user-guide/log-shipping/log-shipping-troubleshooting.html). ## Changelog: +- **1.1.0**: + - Add support to send Lambda Insights from AWS to logz.io platform. [Resolved issue](https://github.com/logzio/logzio_aws_serverless/issues/73) - **1.0.0**: - **Breaking changes**: diff --git a/python3/cloudwatch/sam-template.yaml b/python3/cloudwatch/sam-template.yaml index 324e02e..b926269 100644 --- a/python3/cloudwatch/sam-template.yaml +++ b/python3/cloudwatch/sam-template.yaml @@ -57,8 +57,8 @@ Resources: Runtime: python3.7 Handler: lambda_function.lambda_handler CodeUri: - Bucket: logzio-aws-integrations-us-east-1 - Key: cloudwatch-auto-deployment/1.0.0/logzio-cloudwatch.zip + Bucket: logzio-aws-integrations-<> + Key: cloudwatch-auto-deployment/<>/logzio-cloudwatch.zip FunctionName: logzio-cloudwatch-log-shipper MemorySize: 512 Timeout: 60 diff --git a/python3/cloudwatch/src/lambda_function.py b/python3/cloudwatch/src/lambda_function.py index af1203f..ca72019 100644 --- a/python3/cloudwatch/src/lambda_function.py +++ b/python3/cloudwatch/src/lambda_function.py @@ -2,6 +2,7 @@ import gzip import json import logging +from dateutil import parser import os from io import BytesIO @@ -72,11 +73,19 @@ def _extract_lambda_log_message(log): message_parts = str_message[start_split:].split('\t') size = len(message_parts) if size == PYTHON_EVENT_SIZE or size == NODEJS_EVENT_SIZE: - log['@timestamp'] = message_parts[0] - log['requestID'] = message_parts[1] - log['message'] = message_parts[size - 1] - if size == NODEJS_EVENT_SIZE: - log['log_level'] = message_parts[2] + try: + # Parser only to check if timestamp for Python and NodeJS is pass without + # error, if not skip unparsing log and send as log message. + parser.parse(message_parts[0]) + log['@timestamp'] = message_parts[0] + log['requestID'] = message_parts[1] + log['message'] = message_parts[size - 1] + if size == NODEJS_EVENT_SIZE: + log['log_level'] = message_parts[2] + except Exception as e: + logger.warning( + f'Error occurred while trying to parse log time: {e}.') + pass def _add_timestamp(log): @@ -93,12 +102,14 @@ def _parse_to_json(log): json_object = json.loads(log['message']) if isinstance(json_object, list): # In this case, json_object doesn't have the items() method - logger.info('Field message is a list and cannot be parsed to JSON') + logger.info( + 'Field message is a list and cannot be parsed to JSON') return for key, value in json_object.items(): log[key] = value except Exception as e: - logger.warning(f'Error occurred while trying to parse log to JSON: {e}. Field will be passed as string.') + logger.warning( + f'Error occurred while trying to parse log to JSON: {e}. Field will be passed as string.') pass @@ -119,13 +130,16 @@ def _get_additional_logs_data(aws_logs_data, context): (key, aws_logs_data[key]) for key in additional_fields) try: if 'logGroup' in additional_data: - namespace = get_service_by_log_group_prefix(additional_data['logGroup']) + namespace = get_service_by_log_group_prefix( + additional_data['logGroup']) if namespace == '': - logger.info(f'Mapping from log group to namespace does not exist for log group {additional_data["logGroup"]}') + logger.info( + f'Mapping from log group to namespace does not exist for log group {additional_data["logGroup"]}') else: additional_data['namespace'] = namespace else: - logger.info('Field logGroup does not appear in data. Field namespace will not be added') + logger.info( + 'Field logGroup does not appear in data. Field namespace will not be added') except Exception as e: logger.warning(f'Error while trying to get namespace: {e}') try: diff --git a/python3/kinesis/Makefile b/python3/kinesis/Makefile new file mode 100644 index 0000000..b549eee --- /dev/null +++ b/python3/kinesis/Makefile @@ -0,0 +1,6 @@ +build: + mkdir -p dist/ + zip -j dist/logzio-kinesis-log-shipper.zip src/lambda_function.py ../shipper/shipper.py + +clean: + rm -rf dist/ \ No newline at end of file diff --git a/python3/kinesis/sam-template.yaml b/python3/kinesis/sam-template.yaml index ee678d4..4c46f70 100644 --- a/python3/kinesis/sam-template.yaml +++ b/python3/kinesis/sam-template.yaml @@ -71,7 +71,9 @@ Resources: Properties: Runtime: python3.7 Handler: lambda_function.lambda_handler - CodeUri: ./logzio-kinesis-0.0.2.zip + CodeUri: + Bucket: logzio-aws-integrations-<> + Key: aws-kinesis/<>/logzio-kinesis.zip FunctionName: logzio-kinesis-stream-shipper MemorySize: 512 Timeout: 60