Add tests for parsing slow query user
This commit is contained in:
parent
7446627fae
commit
69d31088f3
1 changed files with 19 additions and 1 deletions
|
|
@ -345,7 +345,7 @@ func TestParseAndEnhance(t *testing.T) {
|
|||
},
|
||||
},
|
||||
ParseAndEnhanceSpec{
|
||||
Title: "RDS Slowquery Log",
|
||||
Title: "RDS Slowquery Log rdsadmin",
|
||||
Line: `2017-04-05T21:57:46+00:00 aws-rds production-aurora-test-db: Slow query: # Time: 190921 16:02:59
|
||||
# User@Host: rdsadmin[rdsadmin] @ localhost [] Id: 1
|
||||
# Query_time: 22.741550 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0SET timestamp=1569081779;call action start_seamless_scaling('AQEAAB1P/PAIqvTHEQFJAEkojZUoH176FGJttZ62JF5QmRehaf0S0VFTa+5MPJdYQ9k0/sekBlnMi8U=', 300000, 2);
|
||||
|
|
@ -361,6 +361,24 @@ SET timestamp=1569862702;`,
|
|||
"user_id": "1",
|
||||
},
|
||||
},
|
||||
ParseAndEnhanceSpec{
|
||||
Title: "RDS Slowquery Log clever user",
|
||||
Line: `2017-04-05T21:57:46+00:00 aws-rds production-aurora-test-db: Slow query: # Time: 190921 16:02:59
|
||||
# User@Host: clever[clever] @ [10.1.11.112] Id: 868
|
||||
# Query_time: 2.000270 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
|
||||
SET timestamp=1571090308;
|
||||
select sleep(2);`,
|
||||
ExpectedOutput: map[string]interface{}{
|
||||
"env": "deploy-env",
|
||||
"hostname": "aws-rds",
|
||||
"programname": "production-aurora-test-db",
|
||||
"decoder_msg_type": "syslog",
|
||||
"rawlog": "Slow query: # Time: 190921 16:02:59\n# User@Host: clever[clever] @ [10.1.11.112] Id: 868\n# Query_time: 2.000270 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0\nSET timestamp=1571090308;\nselect sleep(2);",
|
||||
"timestamp": logTime2,
|
||||
"user": "clever[clever]",
|
||||
"user_id": "868",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, spec := range specs {
|
||||
t.Run(fmt.Sprintf(spec.Title), func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue