Structured log filter on existence of attribute
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
I am gradually porting an old service from TraceSource to Microsoft.Extensions.Logging so that its diagnostics can be more easily exported to telemetry dashboards. I already have a TraceListener that forwards to ILogger, but it cannot know the parameter names, so it emits them as `Arg0`, `Arg1`, and so on. Now when I view those structured logs in the .NET Aspire dashboard, I'd like to search for log entries that were written to TraceSource, rather than directly to ILogger. I thought I'd be able to set up a filter that matches the `Arg0` parameter with any value, but this doesn't seem to be possible.
### Describe the solution you'd like
In the Edit filter modal pane, the Condition dropdown list currently offers these conditions:
* ==
* contains
* !=
* not contains
Add two more conditions to the dropdown list:
* exists\
(Selects log entries in which the specified parameter exists with any value, including empty.)
* not exists\
(Selects log entries in which the specified parameter does not exist.)
If either of those conditions is selected, hide the Value control.
### Additional context
Alternatively, I could use a filter like:
* Parameter: `Arg0`
* Condition: `!=`
* Value: _(empty)_
as the `Arg0` parameter is practically never empty if it is present. However, when I try to set up a filter like that, the filter editor complains "A value is required."
Contributor guide
Research direction
Start by locating the Edit filter modal and the Condition dropdown implementation, then trace how filter values are validated and applied to structured logs. Add exists and not exists conditions, hide the Value control for them, and verify that presence, absence, and empty values behave as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100