sap-ecs-azure-log-forwarder


Namesap-ecs-azure-log-forwarder JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://www.sap.com/
SummaryA package to consume events from an Azure storage queue, process log files, and forward them to a HTTP endpoint or file.
upload_time2024-09-16 23:25:49
maintainerNone
docs_urlNone
authorSAP SE
requires_python<4.0,>=3.8
licenseSAP DEVELOPER LICENSE AGREEMENT
keywords sap azure log forwarder sap log forwarder
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Azure Log Forwarder

Azure Log Forwarder is a Python package that consumes events from an Azure storage queue, processes log files stored in Azure Blob Storage, and forwards the logs either to an HTTP endpoint or writes them to files.

![Image for sap-ecs-azure-log-forwarder](https://raw.githubusercontent.com/sap-ecs-log-forwarders/pypi/main/azure-log-forwarder.png)
## Features

- Consume blob creation events from an Azure storage queue.
- Download and decompress gzipped JSON log files from Azure Blob Storage.
- Forward logs to an HTTP endpoint or write them to files.
- Support for TLS protocol.
- Support for different HTTP authentication methods (Token, API Key).
- Configurable through environment variables.
- Configurable timeout to exit the program if no messages are found for a specified duration.

## Prerequisites

- Python 3.8 or higher.
- An Azure Storage account with a configured event grid and storage queue.
- Azure CLI or Azure portal access to set up the necessary infrastructure.

## Installation
### With internet access:
```sh
pip install sap-ecs-azure-log-forwarder
pip install sap-ecs-azure-log-forwarder==<version>
```

### Without internet access:
- Navigate to the **Download files** section on **pypi.org** for **sap-ecs-azure-log-forwarder** and download the latest .whl (wheel) file. The file will typically have a name that includes details about compatibility (e.g., example_package-1.0-py3-none-any.whl).
- Navigate to the directory where your **.whl** file is located using the cd command, or provide the full path to the **.whl** file when running the pip command.

Run the following command:
```sh
pip install /path/to/your_file.whl
```
**Example**:
```sh
pip install /User/Downloads/sap_ecs_azure_log_forwarder-1.0.2-py3-none-any.whl
```

## Configuration

Set up the following environment variables to configure the Azure Log Forwarder:

- `SAS_TOKEN`: The SAS token for Azure Blob Storage.
- `STORAGE_ACCOUNT_NAME`: The name of your Azure Storage account (required if using SAS token).
- `QUEUE_NAME`: The name of the Azure storage queue to consume events from.
- `TIMEOUT_DURATION`: The time duration in seconds to wait for messages before exiting.
- `OUTPUT_METHOD`: The method to forward logs (`http` or `files`).
- `HTTP_ENDPOINT`: The HTTP endpoint to forward logs to (required if `OUTPUT_METHOD` is `http`).
- `TLS_CERT_PATH`: Path to the TLS certificate for mutual TLS connections.
- `TLS_KEY_PATH`: Path to the TLS key for mutual TLS connections.
- `AUTH_METHOD`: Authentication method (`token`, `api_key`). Default is `token`.
  - **Auth Token**: Set `AUTH_METHOD` to `token` and configure `AUTH_TOKEN`.
    - `AUTH_TOKEN`: Bearer/OAuth token for HTTP endpoint authentication.
  - **API Key**: Set `AUTH_METHOD` to `api_key` and configure `API_KEY`.
    - `API_KEY`: API key for HTTP endpoint API key authentication.
- `OUTPUT_DIR`: The output directory to write log files to (required if `OUTPUT_METHOD` is `files`).

You can set these environment variables in your shell or in a `.env` file.

### Example of setting environment variables in a shell:

```sh
export SAS_TOKEN="your_SAS_token"
export STORAGE_ACCOUNT_NAME="your_storage_account_name"

export QUEUE_NAME="your_queue_name"
export TIMEOUT_DURATION=120  # Timeout after 120 seconds of inactivity. DO NOT set for indefinite runs.

# For http
export OUTPUT_METHOD="http"
export HTTP_ENDPOINT="https://your-http-endpoint.com"
# For TLS certs
export TLS_CERT_PATH="/path/to/your/tls_cert.pem"
export TLS_KEY_PATH="/path/to/your/tls_key.pem"
# For Bearer/OAuth Token authentication
export AUTH_METHOD="token"
export AUTH_TOKEN="your_token"
# For API Key authentication
export AUTH_METHOD="api_key"
export API_KEY="your_api_key"

# For file output
export OUTPUT_METHOD="files"
export OUTPUT_DIR="/path/to/your/output/directory/"
```

## Usage

To run the Azure Log Forwarder, use the following command:
```sh
sap-ecs-azure-log-forwarder
```
This will start the process of consuming events from the storage queue, downloading and processing log files, and forwarding them according to the specified method. The program will exit if no messages are found within the specified timeout duration. If not timeout duration is specified, the program will run indefinitely.

## Things to remember
If you do not set a **TIMEOUT_DURATION**, the program will run indefinitely.

## References
1. [Create SAS tokens for your storage containers](https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-sas-tokens?tabs=Containers)
2. [Creating a Storage Queue](https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-portal)

## License
This application and its source code are licensed under the terms of the SAP Developer License Agreement. See the LICENSE file for more information.

## Release Notes
### 1.0.1
- First proper release!

### 1.0.2
- Updated README with diagrams and instructions on installing the package without access to the internet.

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.sap.com/",
    "name": "sap-ecs-azure-log-forwarder",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "SAP Azure Log Forwarder, SAP Log Forwarder",
    "author": "SAP SE",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# Azure Log Forwarder\n\nAzure Log Forwarder is a Python package that consumes events from an Azure storage queue, processes log files stored in Azure Blob Storage, and forwards the logs either to an HTTP endpoint or writes them to files.\n\n![Image for sap-ecs-azure-log-forwarder](https://raw.githubusercontent.com/sap-ecs-log-forwarders/pypi/main/azure-log-forwarder.png)\n## Features\n\n- Consume blob creation events from an Azure storage queue.\n- Download and decompress gzipped JSON log files from Azure Blob Storage.\n- Forward logs to an HTTP endpoint or write them to files.\n- Support for TLS protocol.\n- Support for different HTTP authentication methods (Token, API Key).\n- Configurable through environment variables.\n- Configurable timeout to exit the program if no messages are found for a specified duration.\n\n## Prerequisites\n\n- Python 3.8 or higher.\n- An Azure Storage account with a configured event grid and storage queue.\n- Azure CLI or Azure portal access to set up the necessary infrastructure.\n\n## Installation\n### With internet access:\n```sh\npip install sap-ecs-azure-log-forwarder\npip install sap-ecs-azure-log-forwarder==<version>\n```\n\n### Without internet access:\n- Navigate to the **Download files** section on **pypi.org** for **sap-ecs-azure-log-forwarder** and download the latest .whl (wheel) file. The file will typically have a name that includes details about compatibility (e.g., example_package-1.0-py3-none-any.whl).\n- Navigate to the directory where your **.whl** file is located using the cd command, or provide the full path to the **.whl** file when running the pip command.\n\nRun the following command:\n```sh\npip install /path/to/your_file.whl\n```\n**Example**:\n```sh\npip install /User/Downloads/sap_ecs_azure_log_forwarder-1.0.2-py3-none-any.whl\n```\n\n## Configuration\n\nSet up the following environment variables to configure the Azure Log Forwarder:\n\n- `SAS_TOKEN`: The SAS token for Azure Blob Storage.\n- `STORAGE_ACCOUNT_NAME`: The name of your Azure Storage account (required if using SAS token).\n- `QUEUE_NAME`: The name of the Azure storage queue to consume events from.\n- `TIMEOUT_DURATION`: The time duration in seconds to wait for messages before exiting.\n- `OUTPUT_METHOD`: The method to forward logs (`http` or `files`).\n- `HTTP_ENDPOINT`: The HTTP endpoint to forward logs to (required if `OUTPUT_METHOD` is `http`).\n- `TLS_CERT_PATH`: Path to the TLS certificate for mutual TLS connections.\n- `TLS_KEY_PATH`: Path to the TLS key for mutual TLS connections.\n- `AUTH_METHOD`: Authentication method (`token`, `api_key`). Default is `token`.\n  - **Auth Token**: Set `AUTH_METHOD` to `token` and configure `AUTH_TOKEN`.\n    - `AUTH_TOKEN`: Bearer/OAuth token for HTTP endpoint authentication.\n  - **API Key**: Set `AUTH_METHOD` to `api_key` and configure `API_KEY`.\n    - `API_KEY`: API key for HTTP endpoint API key authentication.\n- `OUTPUT_DIR`: The output directory to write log files to (required if `OUTPUT_METHOD` is `files`).\n\nYou can set these environment variables in your shell or in a `.env` file.\n\n### Example of setting environment variables in a shell:\n\n```sh\nexport SAS_TOKEN=\"your_SAS_token\"\nexport STORAGE_ACCOUNT_NAME=\"your_storage_account_name\"\n\nexport QUEUE_NAME=\"your_queue_name\"\nexport TIMEOUT_DURATION=120  # Timeout after 120 seconds of inactivity. DO NOT set for indefinite runs.\n\n# For http\nexport OUTPUT_METHOD=\"http\"\nexport HTTP_ENDPOINT=\"https://your-http-endpoint.com\"\n# For TLS certs\nexport TLS_CERT_PATH=\"/path/to/your/tls_cert.pem\"\nexport TLS_KEY_PATH=\"/path/to/your/tls_key.pem\"\n# For Bearer/OAuth Token authentication\nexport AUTH_METHOD=\"token\"\nexport AUTH_TOKEN=\"your_token\"\n# For API Key authentication\nexport AUTH_METHOD=\"api_key\"\nexport API_KEY=\"your_api_key\"\n\n# For file output\nexport OUTPUT_METHOD=\"files\"\nexport OUTPUT_DIR=\"/path/to/your/output/directory/\"\n```\n\n## Usage\n\nTo run the Azure Log Forwarder, use the following command:\n```sh\nsap-ecs-azure-log-forwarder\n```\nThis will start the process of consuming events from the storage queue, downloading and processing log files, and forwarding them according to the specified method. The program will exit if no messages are found within the specified timeout duration. If not timeout duration is specified, the program will run indefinitely.\n\n## Things to remember\nIf you do not set a **TIMEOUT_DURATION**, the program will run indefinitely.\n\n## References\n1. [Create SAS tokens for your storage containers](https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-sas-tokens?tabs=Containers)\n2. [Creating a Storage Queue](https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-portal)\n\n## License\nThis application and its source code are licensed under the terms of the SAP Developer License Agreement. See the LICENSE file for more information.\n\n## Release Notes\n### 1.0.1\n- First proper release!\n\n### 1.0.2\n- Updated README with diagrams and instructions on installing the package without access to the internet.\n",
    "bugtrack_url": null,
    "license": "SAP DEVELOPER LICENSE AGREEMENT",
    "summary": "A package to consume events from an Azure storage queue, process log files, and forward them to a HTTP endpoint or file.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://www.sap.com/"
    },
    "split_keywords": [
        "sap azure log forwarder",
        " sap log forwarder"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ad9028d40650a444d155a715c24ee849f1d720c75d9f726c95f091d542c96f4",
                "md5": "d3db1d3b299e643bd599811c60e29661",
                "sha256": "5c572222c9c7d7dfb038b34f02af4499c1070f3427bce97d5a3ddca9736678d3"
            },
            "downloads": -1,
            "filename": "sap_ecs_azure_log_forwarder-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d3db1d3b299e643bd599811c60e29661",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 13177,
            "upload_time": "2024-09-16T23:25:49",
            "upload_time_iso_8601": "2024-09-16T23:25:49.419123Z",
            "url": "https://files.pythonhosted.org/packages/7a/d9/028d40650a444d155a715c24ee849f1d720c75d9f726c95f091d542c96f4/sap_ecs_azure_log_forwarder-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-16 23:25:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sap-ecs-azure-log-forwarder"
}
        
Elapsed time: 0.33084s