Created by
Василий Котов
last modified
| //скрипт bash
//Получаем топ 10 запросов по общему времени выполнения
cat rphost*/*.log |
sed -r '/^p_[0-9]+: /d' |
sed -r 's/\xef\xbb\xbf//g; s/^[0-9]+:[0-9]+\.[0-9]+-[0-9]+,Context,.,Context=/,Context=/; s/#tt[0-9]+/#tt/g; s/DBMSSQL,.,/DBMSSQL/; s/^[0-9]+:[0-9]+.[0-9]+-/<LineBreak>/' |
gawk -F'DBMSSQL' -vRS='<LineBreak>' '{if ($2 !~ /^$/) {Dur[$2]+=$1; Execs[$2]+=1}} END {for (i in Dur) print "<NewLine>" Dur[i] "=Duration," Execs[i] "=NumOfExec," i }' |
sed -r 's/\s/ /g' |
sed -r /^$/d |
tr '\n' '@' |
sed -r 's/<NewLine>/****************************************************************************************************************************\n/g' |
sort -rnb |
head -n 10 |
sed -r 's/@/\n/g' > top_10_queries.txt
//logcfg.xml (должен лежать здесь - C:\Program Files\1cv8\conf)
<?xml version="1.0"?>
<config xmlns="http://v8.1c.ru/v8/tech-log">
<log location="c:\1c_logs\queries_simple" history="4">
<event>
<eq property="name" value="DBMSSQL"/>
<ge property="Durationus" value="100000"/> <!-- 0,1 секунды -->
</event>
<property name="Sql"/>
<property name="Context"/>
</log>
</config>
|