Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use --log_queries_to_file but limit what’s logged there to queries that had an error #17033

Open
yydoow opened this issue Oct 22, 2024 · 1 comment

Comments

@yydoow
Copy link

yydoow commented Oct 22, 2024

We use --log_queries_to_file option to log queries to file, then these queries are being indexed in ES(elastic search)
We only concerned about the queries that had an error, however this option is not able to filter queries that had an error , then get us many queries on ES.
For a very busy vitess cluster with many vtgate instances, the log volume being huge can potentially make trouble to our ES clusters, and we were not easy to find all these queries had error.

We would like to have an ability to use --log_queries_to_file but limit what’s logged there to queries that had an error
for instance to only log queries that had an error like following.

Execute	10.14.2.68:50732	mmp3user	'mmp3user'	'mmp3user'	2024-10-22 07:15:03.061351	2024-10-22 07:15:03.062363	0.001013	0.000054	0.000956	0.000000	SELECT	"select lbName, lbType, isRankedLB from _lbInfo"	map[]	1	0	"target: ks123.-.primary: vttablet: rpc error: code = NotFound desc = Table 'ks123._lbInfo' doesn't exist (errno 1146) (sqlstate 42S02) (CallerID: mmp3user): Sql: \"select lbName, lbType, isRankedLB from _lbInfo\", BindVars: {}"	"PRIMARY"	"40eea266-7ca7-11ef-b113-bed657433c52"	true	["ks123._lbInfo"]	"ks123"
@yydoow
Copy link
Author

yydoow commented Oct 22, 2024

Execute 10.14.216.254:58722 mmp3user 'mmp3user' 'mmp3user' 2024-10-22 08:00:39.361828 2024-10-22 08:00:39.362485 0.000657 0.000061 0.000591 0.000000 INSERT "insert into userLoginRecords(loginTime, userID, titleID, shardKey) values (:vtg1, :vtg2, :vtg3, :vtg4) on duplicate key update titleID = values(titleID), shardKey = values(shardKey)" map[vtg1:type:INT64 value:"1729584039" vtg2:type:INT64 value:"6214471634113948121" vtg3:type:INT64 value:"2610" vtg4:type:INT64 value:"27097"] 1 0 "target: KS111.-.primary: vttablet: rpc error: code = Unknown desc = Table has no partition for value 1729584039 (errno 1526) (sqlstate HY000) (CallerID: mmp3user): Sql: \"insert into userLoginRecords(loginTime, userID, titleID, shardKey) values (:vtg1, :vtg2, :vtg3, :vtg4) on duplicate key update titleID = values(titleID), shardKey = values(shardKey)\", BindVars: {vtg1: \"type:INT64 value:\\\"1729584039\\\"\"vtg2: \"type:INT64 value:\\\"6214471634113948121\\\"\"vtg3: \"type:INT64 value:\\\"2610\\\"\"vtg4: \"type:INT64 value:\\\"27097\\\"\"}" "PRIMARY" "4a08d052-87a2-11ef-b8d8-2e4f24bc920d" true ["KS111.userLoginRecords"] "KS111"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants