datalust / serilog-sinks-seq

A Serilog sink that writes events to the Seq structured log server
https://datalust.co/seq
Apache License 2.0
239 stars 50 forks source link

Internal Logs created in wrong location #171

Closed mio-moto closed 5 months ago

mio-moto commented 2 years ago

Issue

When developing a serilog configuration including seq, I have encountered that the internal log location gets placed in the wrong folder.

The location of %TMP% is selected fine for the Buffer File, however, the internal log is placed next to the working directory:

image

Reproduciton

My relevant config

{
    "Serilog": {
        "Using": [
            "Serilog.Sinks.Seq",
            "Serilog.Expressions"
        ],
        "MinimumLevel": "Debug",
        "WriteTo": [
            {
                "Name": "Logger",
                "Args": {
                    "configureLogger": {
                        "Filter": [
                            {
                                "Name": "ByExcluding",
                                "Args": {
                                    "expression": "(StartsWith(SourceContext, 'Microsoft')) and (@l in ['Trace', 'Debug', 'Information'])"
                                }
                            }
                        ],
                        "WriteTo": [
                            {
                                "Name": "Seq",
                                "Args": {
                                    "serverUrl": "<some-uri>",
                                    "apiKey": "<some-api-key>",
                                    "bufferBaseFilename": "%TMP%/Logs/hub-app",
                                    "bufferSizeLimitBytes": 1073741824
                                }
                            }
                        ]
                    }
                }
            }
        ]
    },
}

I'm not sure if the filter expression is even relevant, but that's the configuration.

I have another problem with the configuration, as sub-directories do not generated in %TMP%/Logs/something/something/hub-app, but I'm not yet sure if that is a plain user-error.

Additional Environment Infos

nblumhardt commented 2 years ago

Thanks for the note, I agree that this is confusing, we'll take a look 👍

nblumhardt commented 2 years ago

Hi @DarkMio; just reviewing this one, I can't work out how the sink might be creating those internal-*.log files. I initially thought they must be failed request logs, but all file creation in the sink uses either .clef, .json, or .bookmark extensions.

Is it possible the internal log is being generated via Serilog's SelfLog, somehow? Or if not, can you please send a snippet of content from one of the stray files so we can pinpoint it further? Thanks!

KodrAus commented 5 months ago

Just coming back through some triage. It's been a while since we've had any activity on this issue and couldn't reproduce ourselves so I'll go ahead and close this one.

Please feel free to re-open or log any new issues if you're still hitting unexpected behavior.