Skip to content

Commit

Permalink
imp: syslog 적재시, filter 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Aug 6, 2024
1 parent fb81ad9 commit 7c94da1
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,22 @@ class SystemActionLogEventListener(
@EventListener
fun subscribe(event: SystemActionLogEvent) {
CoroutineScope(Dispatchers.IO + Job()).launch {
SystemActionLog(
ipAddress = event.ipAddress,
path = event.path,
httpMethod = event.method,
userAgent = event.userAgent,
host = event.host,
referer = event.referer,
extra = event.extra
).run { systemActionLogService.record(this) }
if (filterLog(event)) {
SystemActionLog(
ipAddress = event.ipAddress,
path = event.path,
httpMethod = event.method,
userAgent = event.userAgent,
host = event.host,
referer = event.referer,
extra = event.extra
).run { systemActionLogService.record(this) }
}
}
}

/** 불필요한 로그는 적재하지 않는다. */
private fun filterLog(event: SystemActionLogEvent): Boolean {
return !event.path.equals("/api/v1/health")
}
}

0 comments on commit 7c94da1

Please sign in to comment.