-
Notifications
You must be signed in to change notification settings - Fork 17
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
Index Wildcards don't appear to work for Dictionaries stored in the event properties #76
Comments
Thanks for looking into this. I am using the latest version of this package (3.4.0) along with the latest SeriLog version (2.11.0). If it matters, we are using an older version of SeriLog.Sinks.MsSqlServer (5.4.0). Could it be an issue with my setup? Apologies if this is too much information. This is the method I call to initialize the logger:
The only other thing I can think of is that perhaps I'm enriching the log in a way that prevents the wildcard from working. Enricher adds the querystring in this block:
Where the properties are defined in HttpContextHelper like so:
And the collection converter:
|
Thanks for the extra details. Something doesn't look right here - as far as I can tell, the |
Thank you for your patience! As far as I can tell, setting the destructureObjects flag doesn't seem to have any effect on how the dictionary is serialized. The log event serializes the same either way:
The escaped quotes around the x and y keys looks unusual to me, is that expected? I've created a minimal reproduction of the issue: here. |
I tried running the repro but unfortunately I'm not on a machine with old-style CSPROJ support ... Here's what I'd planned to try: Instead of writing the log events out with JSON.NET (which doesn't know anything about how Serilog properties are structured; the Destructurama.JsonNet package works the opposite way and makes Serilog aware of JSON.NET types), use:
This will give you Serilog's view of the data. HTH! |
Many thanks! The output still generates the same, with or without the destructure flag:
I'm not really sure what's going on. This looks like it should work, no? |
It seems relevant to mention that we're running on .NET Framework (4.6.2 and up). |
I've recreated the minimal reproduction as a .NET 6 console app here |
Awesome, thanks! I've got it - it's a bug 👍 Will PR a fix and link it here. |
The fix for this is in |
That did the trick! Many many thanks! ♥
|
Awesome, thanks 👍 |
I'm using Serilog.Expressions (3.4.0) to try to filter SQL injection attacks appearing in the query string. I've enriched the log event with the query string as a dictionary. It appears in the log event as:
I can successfully filter by specifying the key:
QueryString['someKey'] like '%UNION ALL SELECT%' ci
However, if I change the index to the "any" wildcard, the expression no longer matches the log event (and therefore isn't filtered):
QueryString[?] like '%UNION ALL SELECT%' ci
The text was updated successfully, but these errors were encountered: