the grok:
^#%{SPACE}Time:%{SPACE}%{NUMBER:YEAR}%{SPACE}%{TIME:time}(?m)\n#%{SPACE}User@Host:%{SPACE}%{WORD:user}\[%{WORD}\]%{SPACE}@%{SPACE}%{WORD:dbhost}?%{SPACE}\[%{IP:ip}\]%{SPACE}Id:%{SPACE}%{NUMBER:Id}(?m)\n#%{SPACE}Query_time:%{SPACE}%{NUMBER:duration:float}%{SPACE}Lock_time:%{SPACE}%{NUMBER:lock_wait:float}%{SPACE}Rows_sent:%{SPACE}%{NUMBER:results:int}%{SPACE}Rows_examined:%{SPACE}%{NUMBER:Rows_examined:int}(?m)\nSET%{SPACE}timestamp=%{NUMBER:timestamp};(?m)\n%{GREEDYDATA:sql}
Need match :
#Time: 161205 10:05:42
#User@Host: xxxxx[xxxxxxx] @ [192.168.130.3] Id: 914013274
#Query_time: 0.004136 Lock_time: 0.000170 Rows_sent: 1 Rows_examined: 4090
SET timestamp=1480903542;
SELECT a.*,b.lon,b.lat,b.info,CONCAT(http://file.myrunners.com/,c.path,c.src) as avatar_src FROM run_group a LEFT JOIN run_grouddddp_positddddion b ON b.run_group_id=a.id LE
FT JOIN file c ON c.id=a.mark_id WHERE ( a.id = 21 ) LIMIT 1;
test for http://grokdebug.herokuapp.com/ :
is OK , but influxdata no data:
SHOW MEASUREMENTS
please help me !
telegraf-1.1.2-1.x86_64
influxdb-1.1.1-1.x86_64
config:
[[inputs.logparser]]
files = ["/apps/mysql/data/mysql-slow.log"]
from_beginning = false
[inputs.logparser.grok]
patterns = ["%{CUSTOM_LOG}"]
custom_patterns = '''CUSTOM_LOG ^#%{SPACE}Time:%{SPACE}%{NUMBER:YEAR}%{SPACE}%{TIME:time}(?m)\n#%{SPACE}User@Host:%{SPACE}%{WORD:user}\[%{WORD}\]%{SPACE}@%{SPACE}%{WORD:dbhost}?%{SPACE}\[%{IP:ip}\]%{SPACE}Id:%{SPACE}%{NUMBER:Id}(?m)\n#%{SPACE}Query_time:%{SPACE}%{NUMBER:duration:float}%{SPACE}Lock_time:%{SPACE}%{NUMBER:lock_wait:float}%{SPACE}Rows_sent:%{SPACE}%{NUMBER:results:int}%{SPACE}Rows_examined:%{SPACE}%{NUMBER:Rows_examined:int}(?m)\nSET%{SPACE}timestamp=%{NUMBER:timestamp};(?m)\n%{GREEDYDATA:sql}'''
measurement = "mysql_slow"