Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Anonymize logs #420

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"dependencies": {
"@algoan/nestjs-http-exception-filter": "^1.0.16",
"@algoan/nestjs-logging-interceptor": "^2.1.14",
"@algoan/nestjs-logging-interceptor": "2.4.0",
"@algoan/rest": "^2.7.0",
"@nestjs/axios": "^0.0.8",
"@nestjs/common": "^8.4.7",
Expand Down
11 changes: 2 additions & 9 deletions src/aggregator/services/bridge/bridge.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,13 @@ export class BridgeClient {
constructor(@Inject(CACHE_MANAGER) private readonly cacheManager: Cache, private readonly httpService: HttpService) {
if (config.activateBridgeRequestInterceptor) {
this.httpService.axiosRef.interceptors.request.use((_config: AxiosRequestConfig): AxiosRequestConfig => {
this.logger.log({
config: _config,
message: `${_config.method} ${_config.url} - Request to Bridge`,
});
this.logger.log(`${_config.method} ${_config.url} - Request to Bridge`);

return _config;
});
this.httpService.axiosRef.interceptors.response.use(
async (response: AxiosResponse) => {
this.logger.log({
message: `${response.config.method} ${response.config.url} - successfully responded`,
body: response.data,
headers: response.headers,
});
this.logger.log(`${response.config.method} ${response.config.url} - successfully responded`);

return Promise.resolve(response);
},
Expand Down
11 changes: 4 additions & 7 deletions src/hooks/services/hooks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class HooksService {
const aggregationStartDate: Date = new Date();
const serviceAccount = this.algoanService.algoanClient.getServiceAccountBySubscriptionId(event.subscription.id);

this.logger.debug(serviceAccount, `Found a service account for subscription "${event.subscription.id}"`);
this.logger.debug(`Found a service account for subscription "${event.subscription.id}"`);

if (serviceAccount === undefined) {
throw new UnauthorizedException(`No service account found for subscription ${event.subscription.id}`);
Expand Down Expand Up @@ -144,7 +144,7 @@ export class HooksService {

// Get user information and client config
const customer: Customer = await this.algoanCustomerService.getCustomerById(payload.customerId);
this.logger.debug({ customer, serviceAccount }, `Found Customer with id ${customer.id}`);
this.logger.debug(`Found Customer with id ${customer.id}`);

const aggregationDetails: AggregationDetails = {
aggregatorName: AggregationDetailsAggregatorName.BRIDGE,
Expand Down Expand Up @@ -203,7 +203,7 @@ export class HooksService {

// Get customer information
const customer: Customer = await this.algoanCustomerService.getCustomerById(payload.customerId);
this.logger.debug({ customer, serviceAccount }, `Found Customer with id ${customer.id}`);
this.logger.debug(`Found Customer with id ${customer.id}`);

// Retrieves an access token from Bridge to access to the user accounts
const authenticationResponse: AuthenticationResponse = await this.aggregator.getAccessToken(
Expand Down Expand Up @@ -232,10 +232,7 @@ export class HooksService {

// Retrieves Bridge banks accounts
const accounts: BridgeAccount[] = await this.aggregator.getAccounts(accessToken, saConfig);
this.logger.debug({
message: `Bridge accounts retrieved for Customer "${customer.id}"`,
accounts,
});
this.logger.debug(`Bridge accounts retrieved for Customer "${customer.id}"`);

// Get account information
let accountInfo: AccountInformation[] = [];
Expand Down