跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 技术方案讨论,移除实时日志中的敏感数据

发表于
最近遇到一个需求,看起来不复杂,但是也研究了一两天,感觉还是挺有意思的,拿出来一起讨论下

需求:准实时移除实时日志中的敏感数据

几个要求:
1. 每 5 分钟将线上日志中的敏感数据脱敏,例如手机号替换成 *
2. 不改现有的代码逻辑
3. 尽可能的轻量化方案,因此限定系统自带脚本(shell 、perl 、python)
4. 日志文件较大 最大 3G, 每天归档,处理过程不能占用过多机器资源
5. 允许丢掉小批量日志, 尽可能少
6. 系统晚上九点之后,不会有用户使用

中间断断续续研究了四五种方案,结合 chatGPT 写的代码。 最终准备采取的方案:

1. 使用 perl 脚本
2. 每五分钟剪切日志文件的前 20M ,到新文件。 循环切分,数据量不会太大,切分过程丢数据少
3. 用 perl 处理新文件,20M 处理起来还是比较快。过程丢数据少
4. 晚上十一点把今天的日志再进行合并成一个

一起讨论下还有哪些更加优雅方案

Featured Replies

没有可显示的帖子

创建帐户或登录来提出意见

Account

导航

搜索

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.