Skip to content

Commit fb3afc7

Browse files
authored
Merge branch 'main' into feature/google-workspace-api
2 parents 5531ac3 + 69fc736 commit fb3afc7

File tree

21 files changed

+183
-35
lines changed

21 files changed

+183
-35
lines changed

.github/workflows/release.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
username: ${{ secrets.DOCKER_USERNAME }}
2323
password: ${{ secrets.DOCKER_PASSWORD }}
2424
- name: Build and push
25-
uses: docker/build-push-action@v5
25+
uses: docker/build-push-action@v6
26+
env:
27+
DOCKER_BUILD_SUMMARY: false
2628
with:
2729
push: true
2830
sbom: true

.github/workflows/tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ jobs:
3636
# Set required environment variables
3737
env:
3838
LOGZIO_API_TOKEN: ${{ secrets.LOGZIO_API_TOKEN }}
39+
LOGZIO_API_TOKEN_2: ${{ secrets.LOGZIO_API_TOKEN_2 }}
3940
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
4041
DOCKERHUB_USER: ${{ secrets.DOCKER_USERNAME }}
4142
LOGZIO_SHIPPING_TOKEN: ${{ secrets.LOGZIO_SHIPPING_TOKEN }}
43+
LOGZIO_SHIPPING_TOKEN_2: ${{ secrets.LOGZIO_SHIPPING_TOKEN_2 }}
4244
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
4345
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
4446
AZURE_AD_SECRET_VALUE: ${{ secrets.AZURE_AD_SECRET_VALUE }}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ And your logzio output under `logzio`:
307307
| url | The logzio Listener address | Optional | `https://listener.logz.io:8071` |
308308
| token | The logzio shipping token | Required | - |
309309

310+
> [!NOTE]
311+
> To configure multiple outputs, please see [multiple outputs example](./src/output/README.md#multiple-outputs)
312+
310313
#### Example
311314
```Yaml
312315
apis:

e2e_tests/api_e2e_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,18 @@ def run_main_program(self, config_path, secrets_map, test=False):
7575
thread.start()
7676
thread.join(timeout=60)
7777

78-
def search_logs(self, query):
78+
def search_logs(self, query, acc=""):
7979
"""
8080
Search logs in logzio based on the provided query.
8181
8282
Args:
8383
query (str): The query string to search for in the logs.
84+
acc (str): The account API to use, default "" for LOGZIO_API_TOKEN, "2" for LOGZIO_API_TOKEN_2.
8485
8586
Returns:
8687
list: A list of log entries that match the query.
8788
"""
88-
return search_data(query)
89+
return search_data(query, acc)
8990

9091
def module_specific_setup(self):
9192
"""

e2e_tests/apis/test_e2e_azure.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import time
23

34
from e2e_tests.api_e2e_test import ApiE2ETest
@@ -20,16 +21,18 @@ def test_azure_data_in_logz(self):
2021
"apis.0.azure_ad_tenant_id": "AZURE_AD_TENANT_ID",
2122
"apis.0.azure_ad_client_id": "AZURE_AD_CLIENT_ID",
2223
"apis.0.azure_ad_secret_value": "AZURE_AD_SECRET_VALUE",
23-
"logzio.token": "LOGZIO_SHIPPING_TOKEN",
24+
"logzio.0.token": "LOGZIO_SHIPPING_TOKEN",
25+
"logzio.1.token": "LOGZIO_SHIPPING_TOKEN_2",
2426
"apis.0.additional_fields.type": "TEST_TYPE"
2527
}
2628
curr_path = abspath(dirname(__file__))
2729
config_path = f"{curr_path}/testdata/azure_api_conf.yaml"
2830
self.run_main_program(config_path=config_path, secrets_map=secrets_map)
2931
time.sleep(120)
3032
logs = self.search_logs(f"type:{self.test_type}")
31-
self.assertTrue(logs)
32-
33+
self.assertTrue(logs, "No logs found in logzio account1")
34+
logs2 = self.search_logs(f"type:{self.test_type}", "2")
35+
self.assertTrue(logs2, "No logs found in logzio account2")
3336

3437
if __name__ == '__main__':
3538
unittest.main()

e2e_tests/apis/testdata/azure_api_conf.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ apis:
1212
scrape_interval: 10
1313

1414
logzio:
15-
url: https://listener.logz.io:8071
16-
token: SHipPIngtoKen
15+
- url: https://listener.logz.io:8071
16+
token: SHipPIngtoKen
17+
inputs: [ azure test ]
18+
- url: https://listener.logz.io:8071
19+
token: SHipPIngtoKen2
20+
inputs:
21+
- azure test

e2e_tests/utils/log_utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
import requests
44

55

6-
def search_data(query):
6+
def search_data(query, account=""):
77
"""
88
Send given search query to logzio and returns the result.
99
:param query:
10+
:param account: the account API to use, "" for LOGZIO_API_TOKEN, "2" for LOGZIO_API_TOKEN_2
1011
:return:
1112
"""
1213
url = "https://api.logz.io/v1/search"
14+
account_env = {
15+
"": "LOGZIO_API_TOKEN",
16+
"2": "LOGZIO_API_TOKEN_2"
17+
}
1318
headers = {
14-
"X-API-TOKEN": os.environ["LOGZIO_API_TOKEN"],
19+
"X-API-TOKEN": os.environ[account_env.get(account)],
1520
"CONTENT-TYPE": "application/json",
1621
"ACCEPT": "application/json"
1722
}

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pydantic~=2.7.1
2-
pyyaml~=6.0.1
3-
requests~=2.32.2
1+
pydantic~=2.10.6
2+
pyyaml~=6.0.2
3+
requests~=2.32.3
44
google~=3.0.0
55
google-auth~=2.38.0

src/apis/cloudflare/Cloudflare.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def __init__(self, **data):
4949

5050
# Update the cloudflare account id in both the url and next url
5151
self.url = self.url.replace("{account_id}", self.cloudflare_account_id)
52-
self.next_url = self.next_url.replace("{account_id}", self.cloudflare_account_id)
52+
if self.next_url:
53+
self.next_url = self.next_url.replace("{account_id}", self.cloudflare_account_id)
5354

5455
if self.days_back_fetch > 0:
5556
self._initialize_url_date()

src/apis/general/Api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ApiFetcher(BaseModel):
3838
:param scrape_interval_minutes: the interval between scraping jobs.
3939
:param url_vars: Not passed to the class, array of params that is generated based on next_url.
4040
:param body_vars: Not passed to the class, array of params that is generated based on next_body.
41+
:param outputs: Not passed to the class, array of outputs to export the returned data to.
4142
"""
4243
name: str = Field(default="")
4344
url: str
@@ -52,6 +53,7 @@ class ApiFetcher(BaseModel):
5253
scrape_interval_minutes: int = Field(default=1, alias="scrape_interval", ge=1)
5354
url_vars: list = Field(default=[], init=False, init_var=True)
5455
body_vars: list = Field(default=[], init=False, init_var=True)
56+
outputs: list = Field(default=[], init=False, init_var=True)
5557

5658
def __init__(self, **data):
5759
"""

0 commit comments

Comments
 (0)