Skip to content

Commit 3f08d8d

Browse files
authored
Update logging example (#42)
1 parent 9a172a2 commit 3f08d8d

7 files changed

Lines changed: 50 additions & 27 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ env:
99
MIN_COVERAGE: "80"
1010
jobs:
1111
build:
12-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php-version: ["7.4", "8.2"]
15+
php-version: [ "8.2", "8.5" ]
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v6
1919
- name: Setup PHP
2020
uses: shivammathur/setup-php@v2
2121
with:
@@ -24,10 +24,11 @@ jobs:
2424
coverage: pcov
2525
- name: Cache Composer packages
2626
id: composer-cache
27-
uses: actions/cache@v3
27+
uses: actions/cache@v5
2828
with:
2929
path: vendor
30-
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
30+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{
31+
hashFiles('**/composer.lock') }}
3132
restore-keys: |
3233
${{ runner.os }}-php-${{ matrix.php-version }}-
3334
- name: Install dependencies
@@ -36,7 +37,7 @@ jobs:
3637
run: ./vendor/bin/phpunit --coverage-cobertura=cobertura.xml tests
3738
- name: Post code coverage to PR comment
3839
if: ${{ github.base_ref != '' }}
39-
uses: 5monkeys/cobertura-action@v13
40+
uses: 5monkeys/cobertura-action@v14
4041
with:
4142
path: cobertura.xml
4243
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -45,22 +46,22 @@ jobs:
4546
minimum_coverage: ${{ env.MIN_COVERAGE }}
4647

4748
lint:
48-
runs-on: ubuntu-22.04
49+
runs-on: ubuntu-latest
4950
steps:
5051
- name: Checkout
51-
uses: actions/checkout@v3
52+
uses: actions/checkout@v6
5253
- name: Setup PHP
5354
uses: shivammathur/setup-php@v2
5455
with:
55-
php-version: "7.4"
56+
php-version: "8.5"
5657
- name: Cache Composer packages
5758
id: composer-cache
58-
uses: actions/cache@v3
59+
uses: actions/cache@v5
5960
with:
6061
path: vendor
61-
key: ${{ runner.os }}-php-7.4-${{ hashFiles('**/composer.lock') }}
62+
key: ${{ runner.os }}-php-8.5-${{ hashFiles('**/composer.lock') }}
6263
restore-keys: |
63-
${{ runner.os }}-php-7.4-
64+
${{ runner.os }}-php-8.5-
6465
- name: Install dependencies
6566
run: composer install --prefer-dist --no-progress
6667
- name: Run lint

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
],
1313
"license": "AGPL-3.0-only OR LicenseRef-ironcore-labs-commercial-license",
1414
"require": {
15-
"php": ">=7.4",
16-
"google/protobuf": "^3.19",
15+
"php": ">=8.2",
16+
"google/protobuf": "^4.33.6",
1717
"ext-openssl": "*",
1818
"ext-curl": "*"
1919
},

examples/batch-example/composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
"license": "Apache-2.0",
1414
"require": {
1515
"php": ">=7.4",
16-
"ironcorelabs/tenant-security-client-php": "^0.2.2"
16+
"ironcorelabs/tenant-security-client-php": "^0.4.0"
1717
},
1818
"autoload": {
1919
"psr-4": {
2020
"IronCore\\": "src/"
2121
}
22+
},
23+
"config": {
24+
"audit": {
25+
"block-insecure": false
26+
}
2227
}
2328
}

examples/logging-example/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ to the TSP. Same thing with "Successfully logged admin add event." but for the a
3232

3333
If you look in the TSP/LD logs you should see something like:
3434

35-
```bash
36-
tenant-security-proxy_1 | {"service":"proxy","message":"Security Event Received","level":"INFO","timestamp":"2022-03-28T18:22:42.699357522+00:00","tenant_id":"tenant-gcp-l","rayid":"syBKJMj8xOI5zSAJ"}
37-
tenant-security-proxy_1 | {"service":"proxy","message":"{\"iclFields\":{\"dataLabel\":\"PII\",\"requestId\":\"Rq8675309\",\"requestingId\":\"userId1\",\"sourceIp\":\"127.0.0.1\",\"objectId\":\"object1\",\"event\":\"USER_LOGIN\"},\"customFields\":{\"field2\":\"gumby\",\"field1\":\"gumby\"}}","level":"INFO","timestamp":"2022-03-28T18:22:42.699385813+00:00","tenant_id":"tenant-gcp-l","rayid":"syBKJMj8xOI5zSAJ"}
38-
tenant-security-proxy_1 | {"service":"proxy","message":"Security Event Received","level":"INFO","timestamp":"2022-03-28T18:22:42.700447605+00:00","tenant_id":"tenant-gcp-l","rayid":"iojQAIWHre2yC-iU"}
39-
tenant-security-proxy_1 | {"service":"proxy","message":"{\"iclFields\":{\"dataLabel\":null,\"requestId\":null,\"requestingId\":\"userId1\",\"sourceIp\":null,\"objectId\":null,\"event\":\"ADMIN_ADD\"},\"customFields\":{}}","level":"INFO","timestamp":"2022-03-28T18:22:42.700471497+00:00","tenant_id":"tenant-gcp-l","rayid":"iojQAIWHre2yC-iU"}
40-
tenant-security-logdriver_1 | {"service":"logdriver","message":"Making request to Stackdriver to write 2 log entries.","level":"INFO","timestamp":"2022-03-28T18:22:42.800555550+00:00","tenant_id":"tenant-gcp-l"}
41-
tenant-security-logdriver_1 | {"service":"logdriver","message":"Successfully wrote 2 log entries to Stackdriver.","level":"INFO","timestamp":"2022-03-28T18:22:42.905105143+00:00","tenant_id":"tenant-gcp-l"}
35+
```
36+
tenant-security-proxy-1 | {"contexts":"request","level":"INFO","service":"proxy","timestamp":"2026-05-05T18:02:22.022940Z","message":"Security Event Received","name":"request","ray_id":"ssxlOOMj0isKWtuQ","tenant_id":"tenant-gcp-l"}
37+
tenant-security-proxy-1 | {"contexts":"request","level":"INFO","service":"proxy","timestamp":"2026-05-05T18:02:22.023068Z","message":"{\"iclFields\":{\"dataLabel\":\"PII\",\"requestId\":\"Rq8675309\",\"requestingId\":\"userId1\",\"sourceIp\":\"127.0.0.1\",\"objectId\":\"object1\",\"event\":\"USER_LOGIN\"},\"customFields\":{\"field1\":\"gumby\",\"field2\":\"gumby\"}}","name":"request","ray_id":"ssxlOOMj0isKWtuQ","tenant_id":"tenant-gcp-l"}
38+
tenant-security-proxy-1 | {"contexts":"request","level":"INFO","service":"proxy","timestamp":"2026-05-05T18:02:22.026257Z","message":"Security Event Received","name":"request","ray_id":"GFYximi8b0xXLC72","tenant_id":"tenant-gcp-l"}
39+
tenant-security-proxy-1 | {"contexts":"request","level":"INFO","service":"proxy","timestamp":"2026-05-05T18:02:22.026271Z","message":"{\"iclFields\":{\"dataLabel\":null,\"requestId\":null,\"requestingId\":\"userId1\",\"sourceIp\":null,\"objectId\":null,\"event\":\"ADMIN_ADD\"},\"customFields\":{}}","name":"request","ray_id":"GFYximi8b0xXLC72","tenant_id":"tenant-gcp-l"}
40+
tenant-security-logdriver-1 | {"contexts":"main;batching;tenant","level":"INFO","service":"logdriver","timestamp":"2026-05-05T18:02:24.087980548Z","message":"BATCH: 2 log events received for an unknown tenant. Using a stdout logger for this tenant.","name":"tenant","tenant_id":"tenant-gcp-l"}
41+
tenant-security-logdriver-1 | {"contexts":"main;batching;stdout client;write-entries","level":"INFO","service":"logdriver","timestamp":"2026-05-05T18:02:24.088209173Z","message":"{\"tenantId\":\"tenant-gcp-l\",\"timestamp\":\"2026-05-05T18:02:17Z\",\"iclFields\":{\"event\":\"USER_LOGIN\",\"logdriverRayId\":\"kHemkWFAGAvnNDr0\",\"sourceIp\":\"127.0.0.1\",\"tspRayId\":\"ray_id\",\"objectId\":\"object1\",\"requestId\":\"Rq8675309\",\"requestingId\":\"userId1\",\"dataLabel\":\"PII\"},\"customFields\":{\"field2\":\"gumby\",\"field1\":\"gumby\"}}","name":"write-entries"}
42+
tenant-security-logdriver-1 | {"contexts":"main;batching;stdout client;write-entries","level":"INFO","service":"logdriver","timestamp":"2026-05-05T18:02:24.088275131Z","message":"{\"tenantId\":\"tenant-gcp-l\",\"timestamp\":\"2026-05-05T18:02:22Z\",\"iclFields\":{\"logdriverRayId\":\"eH4gGBAcJTP0XP39\",\"tspRayId\":\"ray_id\",\"event\":\"ADMIN_ADD\",\"requestingId\":\"userId1\"},\"customFields\":{}}","name":"write-entries"}
4243
```
4344

44-
This shows the TSP receiving these events and sending them to LogDriver, which then batches them up together and sends them to Stackdriver (the configured log sink for `tenant-gcp-l`).
45+
This shows the TSP receiving these events, batching them up together, and sending them successfully to Logdriver. Because this tenant does not have a log sink configured,
46+
the security events will be output to Logdriver's stdout logs.
4547

4648
If you would like to experiment with a different tenant, just do:
4749

examples/logging-example/composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
"license": "Apache-2.0",
1414
"require": {
1515
"php": ">=7.4",
16-
"ironcorelabs/tenant-security-client-php": "^0.2.2"
16+
"ironcorelabs/tenant-security-client-php": "^0.4.0"
1717
},
1818
"autoload": {
1919
"psr-4": {
2020
"IronCore\\": "src/"
2121
}
22+
},
23+
"config": {
24+
"audit": {
25+
"block-insecure": false
26+
}
2227
}
2328
}

examples/rekey-example/composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
"license": "Apache-2.0",
1414
"require": {
1515
"php": ">=7.4",
16-
"ironcorelabs/tenant-security-client-php": "^0.2.1"
16+
"ironcorelabs/tenant-security-client-php": "^0.4.0"
1717
},
1818
"autoload": {
1919
"psr-4": {
2020
"IronCore\\": "src/"
2121
}
22+
},
23+
"config": {
24+
"audit": {
25+
"block-insecure": false
26+
}
2227
}
2328
}

examples/simple-example/composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
"license": "Apache-2.0",
1414
"require": {
1515
"php": ">=7.4",
16-
"ironcorelabs/tenant-security-client-php": "^0.2.0"
16+
"ironcorelabs/tenant-security-client-php": "^0.4.0"
1717
},
1818
"autoload": {
1919
"psr-4": {
2020
"IronCore\\": "src/"
2121
}
22+
},
23+
"config": {
24+
"audit": {
25+
"block-insecure": false
26+
}
2227
}
23-
}
28+
}

0 commit comments

Comments
 (0)