# User@Host: zjzc_app[zjzc_app] @  [10.252.148.16xx]  Id: 6043127
# Query_time: 2.581184 Lock_time: 0.000336 Rows_sent: 6 Rows_examined: 6331310
SET timestamp=1472536079;
select temp.* from ( SELECT
*
FROM
(SELECT
c.sn,
c.userNick,
c.mobilePhone,
date_format(c.registerTime,'%Y/%m/%d') registerTime,
cp.personName,
cp.personCardNo,
cp.gender,
cp.personAuthStatus,
asm.clientManagerSn,
(select personName from ClientPersonalInfo where clientSn = asm.clientManagerSn) as clientManagerName,
IF(1600=asm.clientManagerSn or 1600 IS null, 1, 0) as isMyself,
IFNULL(cei.policyAreaSn,IF( LENGTH(SUBSTRING_INDEX(cm.`governAreas`,';',2))=LENGTH(cm.`governAreas`),SUBSTRING_INDEX(cm.`governAreas`,';',1),NULL )) policyAreaSn,
area.areaName as policyAreaName,
(SELECT IFNULL(SUM(capitalBalance), 0) + IFNULL(SUM(yieldBalance), 0)
FROM view_client_invest_summary
WHERE status =2 AND clientSn=c.`sn` AND DATEDIFF(settlementDate,CURDATE()) <=7
AND DATEDIFF(settlementDate,CURDATE()) >=0 ) investBalance,
(SELECT IFNULL(SUM(capitalBalance), 0) + IFNULL(SUM(yieldBalance), 0)
FROM view_client_invest_summary pr
WHERE pr.clientSn = c.sn AND pr.status = 2 ) unclearedBalance,
(SELECT IFNULL(SUM(capitalBalance), 0) + cai.availableBalance + cai.frozenWithDraw +tra.availableBalance
FROM view_client_invest_summary
WHERE clientSn = c.sn AND status in(1,2)) totalBalance,
(cai.frozenWithDraw + cai.frozenPay) frozenBalance,(cai.availableBalance+tra.availableBalance) availableBalance
FROM
Client c
LEFT JOIN ClientExtraInfo cei on c.sn=cei.clientSn
LEFT JOIN Area area on cei.policyAreaSn=area.sn
LEFT JOIN AssignClientManager asm ON asm.clientSn=c.sn
LEFT JOIN ClientManager cm on cm.sn = asm.clientManagerSn
LEFT JOIN TransferClientAssetInfo tra on c.sn=tra.clientSn,
ClientPersonalInfo cp, ClientAssetInfo cai
WHERE
c.sn = cp.clientSn AND asm.status='1'
AND c.sn = cai.clientSn AND exists (select * from ClientInvestOrder where clientSn = c.sn and status =3) AND c.sn IN (SELECT
asm.clientSn
FROM
AssignClientManager asm
WHERE
asm.clientManagerSn IN
(
1600
) AND asm.status='1')
) t ORDER BY t.clientManagerSn desc,t.sn desc ) temp limit 10,10;
# Time: 160830 14:22:27 (?m)\s*# User@Host:\s+\S+\[%{USER:user}\]\s+@\s+\[%{IP:clientip}\]\s+(?<id>(\S+\s+)*\S+)\s*#\s+Query_time:\s+%{NUMBER:Query_time}\s+Lock_time: %{NUMBER:lock_time}\s+Rows_sent: %{NUMBER:rows_sent}\s+Rows_examined: %{NUMBER:rows_examined}\s*
SET\s+timestamp=%{NUMBER:timestamp};\s*(?<query>(\S+\s+).*)\s*#\s+Time:\s+.* {
"user": [
[
"zjzc_app"
]
],
"clientip": [
[
"10.252.148.164"
]
],
"id": [
[
"Id: 6043127"
]
],
"Query_time": [
[
"2.581184"
]
],
"lock_time": [
[
"0.000336"
]
],
"rows_sent": [
[
"6"
]
],
"rows_examined": [
[
"6331310"
]
],
"timestamp": [
[
"1472536079"
]
],
"query": [
[
"select temp.* from ( SELECT \n\t\t *\n\t\tFROM\n\t\t (SELECT \n\t\t c.sn,\n\t c.userNick,\n\t c.mobilePhone,\n\t date_format(c.registerTime,'%Y/%m/%d') registerTime,\n\t cp.personName,\n\t cp.personCardNo,\n\t cp.gender,\n\t cp.personAuthStatus,\n\t asm.clientManagerSn,\n\t (select personName from ClientPersonalInfo where clientSn = asm.clientManagerSn) as clientManagerName,\n\t IF(1600=asm.clientManagerSn or 1600 IS null, 1, 0) as isMyself,\n\t IFNULL(cei.policyAreaSn,IF( LENGTH(SUBSTRING_INDEX(cm.`governAreas`,';',2))=LENGTH(cm.`governAreas`),SUBSTRING_INDEX(cm.`governAreas`,';',1),NULL )) policyAreaSn,\n\t area.areaName as policyAreaName,\n\t\t\t (SELECT IFNULL(SUM(capitalBalance), 0) + IFNULL(SUM(yieldBalance), 0)\n\t\t\t\tFROM view_client_invest_summary \n\t\t\t\tWHERE status =2 AND clientSn=c.`sn` AND DATEDIFF(settlementDate,CURDATE()) <=7 \n\t\t\t\tAND DATEDIFF(settlementDate,CURDATE()) >=0 ) investBalance,\n\t\t\t (SELECT IFNULL(SUM(capitalBalance), 0) + IFNULL(SUM(yieldBalance), 0)\n\t\t\t\tFROM view_client_invest_summary pr\n\t\t\t\tWHERE pr.clientSn = c.sn AND pr.status = 2 ) unclearedBalance,\n\t\t\t (SELECT IFNULL(SUM(capitalBalance), 0) + cai.availableBalance + cai.frozenWithDraw +tra.availableBalance\n\t\t\t\tFROM view_client_invest_summary\n\t\t\t\tWHERE clientSn = c.sn AND status in(1,2)) totalBalance,\n\t\t\t (cai.frozenWithDraw + cai.frozenPay) frozenBalance,(cai.availableBalance+tra.availableBalance) availableBalance\n\t\t FROM\n\t\t Client c \n\t\t LEFT JOIN ClientExtraInfo cei on c.sn=cei.clientSn \n\t\t LEFT JOIN Area area on cei.policyAreaSn=area.sn\n\t\t LEFT JOIN AssignClientManager asm ON asm.clientSn=c.sn\n\t\t LEFT JOIN ClientManager cm on cm.sn = asm.clientManagerSn\n\t\t LEFT JOIN TransferClientAssetInfo tra on c.sn=tra.clientSn, \n\t\t ClientPersonalInfo cp, ClientAssetInfo cai\n\t\t WHERE\n\t\t c.sn = cp.clientSn AND asm.status='1'\n\t\t AND c.sn = cai.clientSn\n\t\t \n\t\t \t\t \n\t\t \t\t\tAND exists (select * from ClientInvestOrder where clientSn = c.sn and status =3)\n\t\t \t\t \n\t\t \t\t \n\t\t AND c.sn IN (SELECT \n\t\t asm.clientSn\n\t\t FROM\n\t\t AssignClientManager asm\n\t\t WHERE\n\t\t asm.clientManagerSn IN \n\t\t ( \n \t\t 1600\n \t\t ) \n \t\t \n \t\tAND asm.status='1')\t\t\n\t\t ) t\n\t\t \n\t\tORDER BY\n\t\t \n\t\tt.clientManagerSn desc,t.sn desc ) temp limit 10,10;\n"
]
]
}

logstash 解析mysql slow log的更多相关文章

  1. MySQL Slow Log慢日志分析【转】

    如果你的MySQL出现了性能问题,第一个需要“诊断”的就是slow log(慢日志)了. slow log文件很小,使用more less等命令就足够了.如果slow log很大怎么办?这里介绍MyS ...

  2. mysql slow log分析工具的比较

    mysql 中的 slow log 是用来记录执行时间较长(超过 long_query_time 秒)的 sql 的一种日志工具. 启用 slow log 在 my.cnf 中设置 [mysqld] ...

  3. ELK logstash 处理MySQL慢查询日志

    在生产环境下,logstash 经常会遇到处理多种格式的日志,不同的日志格式,解析方法不同.下面来说说logstash处理多行日志的例子,对MySQL慢查询日志进行分析,这个经常遇到过,网络上疑问也很 ...

  4. jdbc autoReconnect=true 参数设置导致 slow log 爆表。

    1.过程 同事按照文档上配置了下面的jdbc url: jdbc:mysql://ip:port/db?autoReconnect=true&useUnicode=true&chara ...

  5. mysql slow 分析工具

    慢查询有什么用?         它能记录下所有执行超过long_query_time时间的SQL语句,帮你找到执行慢的SQL,方便我们对这些SQL进行优化. 测试用 MySQL 版本.   Serv ...

  6. Mysql slow query log

    一.概念部分:  顾名思义,慢查询日志中记录的是执行时间较长的query,也就是我们常说的slow query,通过设--log-slow-queries[=file_name]来打开该功能并设置记录 ...

  7. mysql之 slow log 慢查询日志

    一. 相关参数: • slow_query_log ◦ 是否开启慢查询日志 • slow_query_log_file ◦ 慢查询日志文件名, 在 my.cnf 我们已经定义为slow.log,默认是 ...

  8. MySQL慢查询日志(SLOW LOG)

    慢查询日志可以帮助DBA或开发人员定位可能存在问题的SQL语句,从而进行优化. 如何开启 默认情况下,MySQL是不开启慢查询日志的.可以通过以下命令查看是否开启: mysql> SHOW VA ...

  9. 解析mysql慢日志

    mysql慢日志太多,需要分析下具体有哪些慢日志 mysql可以直接记录所有慢日志,现在的问题是将日志文件sql进行去重 想了老半天该怎样将sql的查询字段去掉进行排序,没有get到重点.后来发现my ...

随机推荐

  1. union all合并记录

    SQL> SELECT empno AS 编码, ename AS 名称, nvl(mgr, deptno) AS 上级编码 FROM emp 2 order by empno 3 UNION ...

  2. mybatis源代码分析:深入了解mybatis延迟加载机制

    下文从mybatis(3.2.7)延迟加载样例讲起,逐步深入其实现机制. 下面的例子是Student类关联一个Teacher对象,在访问Student对象时,不立即加载其关联的Teacher对象,而是 ...

  3. 给Eclipse安装Google app engine插件

    1.一般的做法: 参考:https://developers.google.com/eclipse/docs/install-eclipse-4.3 2. 因为 上面的做法一直没有成功,改为下载离线包 ...

  4. deflate与gzip

    gzip是一种数据格式,默认且目前仅使用deflate算法压缩data部分: deflate是一种压缩算法,是huffman编码的一种加强. deflate与gzip解压的代码几乎相同,可以合成一块代 ...

  5. JSP SMARTUPLOAD组件:上传文件时同时获取表单参数

    原因很简单: 注意更改from 属性啊!否则为null! 因为你用jspsmartuploadsmart时post请求 的格式是multipart/form-data,即enctype="m ...

  6. Android应用切换皮肤功能实现(二)

    原文地址http://www.apkbus.com/forum.php?mod=viewthread&tid=149034&highlight=%E7%9A%AE%E8%82%A4 上 ...

  7. SQL:define和verify命令及替换变量&

    =================替换变量&===============使用一个&符号来指定一个变量值,执行SQL语句时,会提示用户输入一个数值. SQL> select sa ...

  8. Android学习笔记--服务(Service)

    1.服务概述 1.服务是Android四大组件之一,在使用上可以分为本地服务和远程服务,本地服务是指在不影响用户操作的情况下在后台默默的执行一个耗时操作,例如下载,音频播放等.远程服务是指可以供其他应 ...

  9. 模板页 相对路径 JS 加载问题

    问题:我在master页面中引入了如下js文件:<script type="text/javascript" src="http://www.cnblogs.com ...

  10. 写一个Windows上的守护进程(8)获取进程路径

    写一个Windows上的守护进程(8)获取进程路径 要想守护某个进程,就先得知道这个进程在不在.我们假设要守护的进程只会存在一个实例(这也是绝大部分情形). 我是遍历系统上的所有进程,然后判断他们的路 ...