mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 14:31:02 +00:00 
			
		
		
		
	feat: add a EXCLUSION to the logger (#8212)
		
	This feature is intended to help reduce noisy logs generated by routine Kubernetes probes and Prometheus scraping. While logs are essential, these specific requests (e.g., to /metrics and /api/healthz) generally don't provide useful information and tend to clutter the output. The goal is to introduce functionality that effectively acts as the inverse of the existing EXPRESSION mode—allowing logging to be excluded based on a condition, rather than included. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8212 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: zokki <zokki.softwareschmiede@gmail.com> Co-committed-by: zokki <zokki.softwareschmiede@gmail.com>
This commit is contained in:
		
					parent
					
						
							
								b669564f39
							
						
					
				
			
			
				commit
				
					
						72620db8df
					
				
			
		
					 9 changed files with 100 additions and 0 deletions
				
			
		|  | @ -44,6 +44,11 @@ func defaultLoggingFlags() []cli.Flag { | |||
| 			Aliases: []string{"e"}, | ||||
| 			Usage:   "Matching expression for the logger", | ||||
| 		}, | ||||
| 		&cli.StringFlag{ | ||||
| 			Name:    "exclusion", | ||||
| 			Aliases: []string{"x"}, | ||||
| 			Usage:   "Exclusion for the logger", | ||||
| 		}, | ||||
| 		&cli.StringFlag{ | ||||
| 			Name:    "prefix", | ||||
| 			Aliases: []string{"p"}, | ||||
|  | @ -286,6 +291,9 @@ func commonAddLogger(ctx context.Context, c *cli.Command, mode string, vals map[ | |||
| 	if len(c.String("expression")) > 0 { | ||||
| 		vals["expression"] = c.String("expression") | ||||
| 	} | ||||
| 	if len(c.String("exclusion")) > 0 { | ||||
| 		vals["exclusion"] = c.String("exclusion") | ||||
| 	} | ||||
| 	if len(c.String("prefix")) > 0 { | ||||
| 		vals["prefix"] = c.String("prefix") | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue