记一次notepad++将es的数据文本的某id过滤出来

Posted 自行车在路上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了记一次notepad++将es的数据文本的某id过滤出来相关的知识,希望对你有一定的参考价值。

之前不知怎么弄,其实主要是根据notepad++的正则表达式,正则表达式挺好用的

从es拿出来的复制出来的数据是这样的

message:2022-01-19 03:00:17.390 [TID:N/A] [ConsumeMessageThread_2] INFO c.a.c.biz.mq.consumer - rocketmq-接受"author_id":"3008713055548956","id":"705438733316","title":"#豪华","url":"https://**?video_id=v0200fg10000c7j3gorc77u3jelvn550&line=1&file_id=b254f457e9684496994c3493edd79462&sign=e6e1a89323ad419a613ad5127cf1ab2c&is_play_url=1&source=PackSourceEnum_PUBLISH","cmd_id":"1001050193822441472","ctime":"2022-01-19 03:00:17","duration":34784,"platform":"douyin","publish_time":"2022-01-18 11:48:02","tag":"quality" Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7cdb7028] was not registered for synchronization because synchronization is not active Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@21a2c5ac] was not registered for synchronization because synchronization is not active @timestamp:Jan 19, 2022 @ 03:00:17.390 agent.ephemeral_id:70ecf2e5-44b8-415a-a2aa-6b0afdfa6ff1 agent.hostname:filebeat-localssd-filebeat-5dd8l agent.id:5b4d8cef-1b13-40df-9b10-fafcb877fa33 agent.name:filebeat-localssd-filebeat-5dd8l agent.type:filebeat agent.version:7.13.2 container.id:f534966f490d848020aa13539d311a4923c9bd6bbb1eb0459eec98adb07e5555 container.image.name:registry-vpc.cn-hangzhou.aliyuncs.com/afanticar/content-center:V1.4.1-265-g0737304 container.runtime:containerd ecs.version:1.8.0 host.name:filebeat-localssd-filebeat-5dd8l input.type:container kubernetes.container.image:registry-vpc.cn-hangzhou.aliyuncs.com/afanticar/content-center:V1.4.1-265-g0737304 kubernetes.container.name:content-center kubernetes.labels.app_kubernetes_io/instance:content-center kubernetes.labels.app_kubernetes_io/name:content-center kubernetes.labels.istio_io/rev:default kubernetes.labels.pod-template-hash:86867d444b kubernetes.labels.security_istio_io/tlsMode:istio kubernetes.labels.service_istio_io/canonical-name:content-center kubernetes.labels.service_istio_io/canonical-revision:latest kubernetes.namespace:java-ms kubernetes.namespace_labels.field_cattle_io/projectId:p-srqmj kubernetes.namespace_labels.istio-injection:enabled kubernetes.namespace_uid:86df2faf-2410-4152-b651-462611bae8dc kubernetes.node.hostname:baselab02195uat kubernetes.node.labels.ack_aliyun_com:c91660c482e7f45dd8c3dcdd77db6755b kubernetes.node.labels.alibabacloud_com/nodepool-id:np259dddc58d694db486f55545241b87ef kubernetes.node.labels.beta_kubernetes_io/arch:amd64 kubernetes.node.labels.beta_kubernetes_io/instance-type:ecs.c5.2xlarge kubernetes.node.labels.beta_kubernetes_io/os:linux kubernetes.node.labels.failure-domain_beta_kubernetes_io/region:cn-hangzhou kubernetes.node.labels.failure-domain_beta_kubernetes_io/zone:cn-hangzhou-g kubernetes.node.labels.kubernetes_io/arch:amd64 kubernetes.node.labels.kubernetes_io/hostname:baselab02195uat kubernetes.node.labels.kubernetes_io/os:linux kubernetes.node.labels.node_kubernetes_io/instance-type:ecs.c5.2xlarge kubernetes.node.labels.policy:release kubernetes.node.labels.topology_diskplugin_csi_alibabacloud_com/zone:cn-hangzhou-g kubernetes.node.labels.topology_kubernetes_io/region:cn-hangzhou kubernetes.node.labels.topology_kubernetes_io/zone:cn-hangzhou-g kubernetes.node.labels.workload_type:spot kubernetes.node.name:baselab02195uat kubernetes.node.uid:3ead14ec-572e-4f46-824f-35cf7d04f2f1 kubernetes.pod.ip:172.16.5.86 kubernetes.pod.name:content-center-86867d444b-767pw kubernetes.pod.uid:9a365b5b-0e75-4305-827e-b4aca1793985 kubernetes.replicaset.name:content-center-86867d444b log.file.path:/var/log/containers/content-center-86867d444b-767pw_java-ms_content-center-f534966f490d848020aa13539d311a4923c9bd6bbb1eb0459eec98adb07e5555.log log.flags:multiline log.offset:1,961,273 stream:stdout _id:tGmPbn4BkPywUEWoz8NJ _index:content-center-2022.01.19 _score: - _type:_doc

Jan 19, 2022 @ 02:57:34.679	message:2022-01-19 02:57:34.679 [TID:N/A] [ConsumeMessageThread_20] INFO c.a.c.biz.mq.consumer - rocketmq-接受"author_id":"98166744859","id":"7054343271390848263","title":"汽车 ","url":"https://**?video_id=v0200fg10000c7j2fr3c77ub1e952rlg&line=1&file_id=94ba827e06614f7994ed27884f19ce6c&sign=8bd150eede895346e4fb54c640a35525&is_play_url=1&source=PackSourceEnum_PUBLISH","cmd_id":"1001050147190169600","ctime":"2022-01-19 02:57:34","duration":69869,"platform":"douyin","publish_time":"2022-01-18 10:37:36","tag":"quality" null--->[HTTP/1.1 200 OK] Server--->[Apache] Access-Control-Allow-Origin--->[*] Access-Control-Allow-Methods--->[POST, GET, DELETE, OPTIONS, DELETE] Connection--->[keep-alive] P3p--->[CP=" OTI DSP COR IVA OUR IND COM "] Date--->[Tue, 18 Jan 2022 18:57:34 GMT] Access-Control-Allow-Headers--->[Content-Type, x-requested-with, X-Custom-Header, HaiYi-Access-Token] X-Baidu-Request-Id--->[e7bf418961ab2e46cca0a82b27f7fff21001020] Appid--->[25428986] X-B3-Spanid--->[7f3f6eda-7890-11ec-b201-b908dc8d3d05] X-B3-Traceid--->[7f3f6edb-7890-11ec-b201-b908dc8d3d05] Vary--->[Accept-Encoding] Set-Cookie--->[BAIDUID=2FC0720CCA1A59E4B444D59C21B42916:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2145916555; path=/; domain=.baidu.com; version=1] Content-Length--->[140] Content-Type--->[application/json] result:"person_num":0,"person_info":["attributes":"","location":"score":0,"top":0,"left":0,"width":0,"height":0],"log_id":1483513918412280776 @timestamp:Jan 19, 2022 @ 02:57:34.679 agent.ephemeral_id:70ecf2e5-44b8-415a-a2aa-6b0afdfa6ff1 agent.hostname:filebeat-localssd-filebeat-5dd8l agent.id:5b4d8cef-1b13-40df-9b10-fafcb877fa33 agent.name:filebeat-localssd-filebeat-5dd8l agent.type:filebeat agent.version:7.13.2 container.id:f534966f490d848020aa13539d311a4923c9bd6bbb1eb0459eec98adb07e5555 container.image.name:registry-vpc.cn-hangzhou.aliyuncs.com/afanticar/content-center:V1.4.1-265-g0737304 container.runtime:containerd ecs.version:1.8.0 host.name:filebeat-localssd-filebeat-5dd8l input.type:container kubernetes.container.image:registry-vpc.cn-hangzhou.aliyuncs.com/afanticar/content-center:V1.4.1-265-g0737304 kubernetes.container.name:content-center kubernetes.labels.app_kubernetes_io/instance:content-center kubernetes.labels.app_kubernetes_io/name:content-center kubernetes.labels.istio_io/rev:default kubernetes.labels.pod-template-hash:86867d444b kubernetes.labels.security_istio_io/tlsMode:istio kubernetes.labels.service_istio_io/canonical-name:content-center kubernetes.labels.service_istio_io/canonical-revision:latest kubernetes.namespace:java-ms kubernetes.namespace_labels.field_cattle_io/projectId:p-srqmj kubernetes.namespace_labels.istio-injection:enabled kubernetes.namespace_uid:86df2faf-2410-4152-b651-462611bae8dc kubernetes.node.hostname:baselab02195uat kubernetes.node.labels.ack_aliyun_com:c91660c482e7f45dd8c3dcdd77db6755b kubernetes.node.labels.alibabacloud_com/nodepool-id:np259dddc58d694db486f55545241b87ef kubernetes.node.labels.beta_kubernetes_io/arch:amd64 kubernetes.node.labels.beta_kubernetes_io/instance-type:ecs.c5.2xlarge kubernetes.node.labels.beta_kubernetes_io/os:linux kubernetes.node.labels.failure-domain_beta_kubernetes_io/region:cn-hangzhou kubernetes.node.labels.failure-domain_beta_kubernetes_io/zone:cn-hangzhou-g kubernetes.node.labels.kubernetes_io/arch:amd64 kubernetes.node.labels.kubernetes_io/hostname:baselab02195uat kubernetes.node.labels.kubernetes_io/os:linux kubernetes.node.labels.node_kubernetes_io/instance-type:ecs.c5.2xlarge kubernetes.node.labels.policy:release kubernetes.node.labels.topology_diskplugin_csi_alibabacloud_com/zone:cn-hangzhou-g kubernetes.node.labels.topology_kubernetes_io/region:cn-hangzhou kubernetes.node.labels.topology_kubernetes_io/zone:cn-hangzhou-g kubernetes.node.labels.workload_type:spot kubernetes.node.name:baselab02195uat kubernetes.node.uid:3ead14ec-572e-4f46-824f-35cf7d04f2f1 kubernetes.pod.ip:172.16.5.86 kubernetes.pod.name:content-center-86867d444b-767pw kubernetes.pod.uid:9a365b5b-0e75-4305-827e-b4aca1793985 kubernetes.replicaset.name:content-center-86867d444b log.file.path:/var/log/containers/content-center-86867d444b-767pw_java-ms_content-center-f534966f490d848020aa13539d311a4923c9bd6bbb1eb0459eec98adb07e5555.log log.flags:multiline log.offset:1,517,115 stream:stderr _id:9WmNbn4BkPywUEWoOpj7 _index:content-center-2022.01.19 _score: - _type:_doc

Jan 19, 2022 @ 02:57:32.019	message:2022-01-19 02:57:32.019 [TID:N/A] [ConsumeMessageThread_17] INFO c.a.c.biz.mq.consumer - rocketmq-接受"author_id":"2062315669175260","id":"70544342343453191","title":"#奔驰 ","url":"https://**?video_id=v0200fg10000c7j6errc77u9i2aflgt0&line=1&file_id=2a746cb958d64905bf497c3c54952a6d&sign=7f860bee3aa49e86a009cea5d22473c2&is_play_url=1&source=PackSourceEnum_PUBLISH","cmd_id":"1001050104043364353","ctime":"2022-01-19 02:57:31","duration":15114,"platform":"douyin","publish_time":"2022-01-18 17:30:00","tag":"quality" null--->[HTTP/1.1 200 OK] Server--->[Apache] Access-Control-Allow-Origin--->[*] Access-Control-Allow-Methods--->[POST, GET, DELETE, OPTIONS, DELETE] Connection--->[keep-alive] P3p--->[CP=" OTI DSP COR IVA OUR IND COM "] Date--->[Tue, 18 Jan 2022 18:57:32 GMT] Access-Control-Allow-Headers--->[Content-Type, x-requested-with, X-Custom-Header, HaiYi-Access-Token] X-Baidu-Request-Id--->[a93dacab0c380794389b37d7a70a15541000412] Appid--->[25428986] X-B3-Spanid--->[7d939352-7890-11ec-945e-978457e63117] X-B3-Traceid--->[7d939353-7890-11ec-945e-978457e63117] Vary--->[Accept-Encoding] Set-Cookie--->[BAIDUID=701661C2DB127D1483BD3B2289A02F8C:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2145916555; path=/; domain=.baidu.com; version=1] Content-Length--->[140] Content-Type--->[application/json] result:"person_num":0,"person_info":["attributes":"","location":"score":0,"top":0,"left":0,"width":0,"height":0],"log_id":1483513905442596665 @timestamp:Jan 19, 2022 @ 02:57:32.019 agent.ephemeral_id:70ecf2e5-44b8-415a-a2aa-6b0afdfa6ff1 agent.hostname:filebeat-localssd-filebeat-5dd8l agent.id:5b4d8cef-1b13-40df-9b10-fafcb877fa33 agent.name:filebeat-localssd-filebeat-5dd8l agent.type:filebeat agent.version:7.13.2 container.id:f534966f490d848020aa13539d311a4923c9bd6bbb1eb0459eec98adb07e5555 container.image.name:registry-vpc.cn-hangzhou.aliyuncs.com/afanticar/content-center:V1.4.1-265-g0737304 container.runtime:containerd ecs.version:1.8.0 host.name:filebeat-localssd-filebeat-5dd8l input.type:container kubernetes.container.image:registry-vpc.cn-hangzhou.aliyuncs.com/afanticar/content-center:V1.4.1-265-g0737304 kubernetes.container.name:content-center kubernetes.labels.app_kubernetes_io/instance:content-center kubernetes.labels.app_kubernetes_io/name:content-center kubernetes.labels.istio_io/rev:default kubernetes.labels.pod-template-hash:86867d444b kubernetes.labels.security_istio_io/tlsMode:istio kubernetes.labels.service_istio_io/canonical-name:content-center kubernetes.labels.service_istio_io/canonical-revision:latest kubernetes.namespace:java-ms kubernetes.namespace_labels.field_cattle_io/projectId:p-srqmj kubernetes.namespace_labels.istio-injection:enabled kubernetes.namespace_uid:86df2faf-2410-4152-b651-462611bae8dc kubernetes.node.hostname:baselab02195uat kubernetes.node.labels.ack_aliyun_com:c91660c482e7f45dd8c3dcdd77db6755b kubernetes.node.labels.alibabacloud_com/nodepool-id:np259dddc58d694db486f55545241b87ef kubernetes.node.labels.beta_kubernetes_io/arch:amd64 kubernetes.node.labels.beta_kubernetes_io/instance-type:ecs.c5.2xlarge kubernetes.node.labels.beta_kubernetes_io/os:linux kubernetes.node.labels.failure-domain_beta_kubernetes_io/region:cn-hangzhou kubernetes.node.labels.failure-domain_beta_kubernetes_io/zone:cn-hangzhou-g kubernetes.node.labels.kubernetes_io/arch:amd64 kubernetes.node.labels.kubernetes_io/hostname:baselab02195uat kubernetes.node.labels.kubernetes_io/os:linux kubernetes.node.labels.node_kubernetes_io/instance-type:ecs.c5.2xlarge kubernetes.node.labels.policy:release kubernetes.node.labels.topology_diskplugin_csi_alibabacloud_com/zone:cn-hangzhou-g kubernetes.node.labels.topology_kubernetes_io/region:cn-hangzhou kubernetes.node.labels.topology_kubernetes_io/zone:cn-hangzhou-g kubernetes.node.labels.workload_type:spot kubernetes.node.name:baselab02195uat kubernetes.node.uid:3ead14ec-572e-4f46-824f-35cf7d04f2f1 kubernetes.pod.ip:172.16.5.86 kubernetes.pod.name:content-center-86867d444b-767pw kubernetes.pod.uid:9a365b5b-0e75-4305-827e-b4aca1793985 kubernetes.replicaset.name:content-center-86867d444b log.file.path:/var/log/containers/content-center-86867d444b-767pw_java-ms_content-center-f534966f490d848020aa13539d311a4923c9bd6bbb1eb0459eec98adb07e5555.log log.flags:multiline log.offset:1,483,484 stream:stderr _id:1WmNbn4BkPywUEWoL5g_ _index:content-center-2022.01.19 _score: - _type:_doc

利用正则表达式将id过滤出来
可看出规则,将id前面替换成空

.*"id":"

将title后面的替换为空

","title".*


这样就过滤出来id了
去掉空行

在菜单栏中找到【编辑】-->【行操作】-->【移除空白行(包括空白字符)】,可以将所有的空白行删除


id这样弄好了

有时候要去拿着id去数据库查询in(“1”,“2”),可以这样拼接,将光标移到最前面

按ctrl+c,弹出列编辑

后面不对齐,所以将光标移到后一点,后面ctrl+c再加

",



再去掉空格,ctrl+h将空格替换


去掉换行

\\r\\n



最后去掉最后面的逗号

这样就可以去其他地方查找es或者数据库查找

以上是关于记一次notepad++将es的数据文本的某id过滤出来的主要内容,如果未能解决你的问题,请参考以下文章

记一次日志采集问题:logstash没有向ES写入数据

记一次 Notepad++ 安装 NppFTP 连接 Linux 系统(例如:Centos)

记一次ES查询结果集失败

记一次ES日志系统的接入

记一次线上环境 ES 主分片为分配故障

记一次调优过程—Spark读取OBS文件入ES