Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 29 23:05

    nblumhardt on dev

    Remove redundant `.` from examp… (compare)

  • Jun 23 23:51

    dependabot[bot] on nuget

    (compare)

  • Jun 23 23:51

    nblumhardt on dev

    Bump Newtonsoft.Json in /test/S… Merge pull request #50 from ser… (compare)

  • Jun 23 23:49

    dependabot[bot] on nuget

    (compare)

  • Jun 22 21:48

    dependabot[bot] on nuget

    Bump Newtonsoft.Json in /test/S… (compare)

  • Jun 22 15:34

    dependabot[bot] on nuget

    Bump Newtonsoft.Json in /test/S… (compare)

  • Jun 22 15:23

    dependabot[bot] on nuget

    Bump Newtonsoft.Json in /test/S… (compare)

  • Jun 22 15:23

    dependabot[bot] on nuget

    Bump Newtonsoft.Json in /test/S… (compare)

  • Jun 22 15:23

    dependabot[bot] on nuget

    Bump Newtonsoft.Json in /src/Se… (compare)

  • Jun 22 00:06

    serilog-build on v3.0.0

    (compare)

  • Jun 22 00:05

    serilog-build on v79

    (compare)

  • Jun 22 00:02

    nblumhardt on dev

    Dev version bump [skip ci] (compare)

  • Jun 22 00:01

    nblumhardt on main

    Dev version bump [skip ci] Don't specify --version-suffix … Merge pull request #56 from nbl… and 2 more (compare)

  • Jun 22 00:01

    nblumhardt on dev

    Revert dev version bump [skip c… (compare)

  • Jun 22 00:00

    nblumhardt on dev

    Don't specify --version-suffix … Merge pull request #56 from nbl… (compare)

  • Jun 21 23:46

    nblumhardt on dev

    Dev version bump [skip ci] (compare)

  • Jun 21 23:46

    nblumhardt on main

    Align `<VersionPrefix>` & `<Tar… Add missing `Microsoft.Extensio… Change `<VersionPrefix>` from 3… and 12 more (compare)

  • Jun 21 23:38

    nblumhardt on dev

    Update README to ASP.NET Core 6… Update README.md Merge pull request #54 from mma… (compare)

  • May 13 00:17

    nblumhardt on dev

    Remove out of support target fr… Merge pull request #311 from 0x… (compare)

  • May 12 14:20

    skomis-mm on dev

    Fix some warnings and suggestio… Merge pull request #313 from 0x… (compare)

Divvy-Jeramel
@JA-Divvy
@bartelink thanks for your response, will do you suggestion.
Ashutosh Kurup
@ashutosh.kurup:matrix.org
[m]
Hi All
I have implemeted Serilog wiht Graylog
Not able to see any messgaes in Graylog
any help
Ashutosh Kurup
@ashutosh.kurup:matrix.org
[m]
Below is the code
public class SeriLogConfiguration
{
public static Logger Instance
{
get
{
return GetLogger(SeriLogSettings.CreateFromAppSettings());
}
}
private static Logger _logger;
public SeriLogConfiguration(SeriLogSettings options)
{
_options = options;
SeriLogConfiguration.GetLogger(_options);
}
    public static Logger GetLogger(SeriLogSettings options)
    {
        if (_logger == null)
        {

            var _loggerConfig = new LoggerConfiguration(); //.ReadFrom.AppSettings();                
            _loggerConfig.WriteTo.Async(a => a.Graylog(GetSink(options))); 
            _logger = _loggerConfig.CreateLogger();


        }
        return _logger;
    }
    public static Logger InitiateLog
    {
        get { return _logger; }
    }

    public static GraylogSinkOptions GetSink(SeriLogSettings options)
    {
        return new GraylogSinkOptions
        {
            HostnameOrAddress = options.HostNameOrAddress,
            Port = options.Port,
            TransportType = TransportType.Http,                               
            HttpClientFactory = () =>
            {
                var http = new HttpClient(new HttpClientHandler());
                http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", options.BasicAuth);
                return http;
            }
        };
    }

    private readonly SeriLogSettings _options;

}
Ruben Bartelink
@bartelink
See above...
Daniel Hughes
@trampster
Does the graylog sync work with graylog 4?
The readme on the repo says it supports graylog 2. Does this mean that 4 is unsupported?
Daniel Hughes
@trampster
@ashutosh.kurup:matrix.org I also cannot get messages to log to graylog
It's frustrating that it just silently fails, so there is no way to figure out what might be wrong
Daniel Hughes
@trampster
@ashutosh.kurup:matrix.org how does your GraylogSinkOptions have a HttpClientFactory property, mine doesn't. What nuget package are you using? I'm using Serilog.Sinks.Graylog Version="2.3.0"
Daniel Hughes
@trampster
I've discovered the serilog seems to be sending a binary payload in but GELF is a text format
GraylogSinkOptionsBase has the DefaultFacility set to GELF
Daniel Hughes
@trampster
I've discovered that the problem is with the Compression
I commented the code that does compression and now it works
(this isn't configurable)
So now I'm faced with having to use a local fork to have it working
Nicholas Blumhardt
@nblumhardt
Looks like the repo is pretty active, @trampster - could pitch a PR to add this to GraylogSinkOptions?
Frank Bolero
@frankbolero
Is there a good way to trace user actions with serilog? My users are authenticated so I guess that's easy, but what i would want is to add an unique identifier for each API call from a user and then add that Unique Id to each method called and logged from that API call. Does that make sense?
1 reply
The idea here is to create a traceability of each method performed from one API call, so I could look one up in Elastic (our log indexer) and the look up that unique ID and find all log posts with the unique id.
Luiz-Ossinho
@Luiz-Ossinho
hey, good morning everyone, can someone checkout serilog/serilog-extensions-logging#204
those few lines are quite usefull for a use case in the company where i work
Luiz-Ossinho
@Luiz-Ossinho
nblumhardt directed me towards https://github.com/serilog/serilog-extensions-hosting, wich has an overload that exposes the IServiceProvider used.
My PR no longer has any purprose.
Mark Olbert
@markolbert
Can Serilog's file sink be used with a packaged WinUI3 app? My app crashes when writing to the log file in certain circumstances (e.g., from within an event handler triggered by a different thread than the one hosting the Serilog instance)
13 replies
Themis Theotokatos
@themhz
Severity Code Description Project File Line Suppression State
Error CS1061 'LoggerSinkConfiguration' does not contain a definition for 'Console' and no accessible extension
method 'Console' accepting a first argument of type 'LoggerSinkConfiguration' could be found (are you missing a using directive or an assembly reference?)
my code
using (var log = new LoggerConfiguration()
.WriteTo.Console()
.CreateLogger())
{
log.Information("Hello, Serilog!");
log.Warning("Goodbye, Serilog.");
}
how can I fix this?
Nicholas Blumhardt
@nblumhardt
@themhz dotnet add package serilog.sinks.console
Fynzie
@FynZ
:wave: Hello guys, quick question regarding parameter alteration. Is it possible to limit string size when passing parameters (no destructuring) to a log ? I know of Destructure.ToMaximumStringLength but obviously it does not apply to strings themselves if for example I call logger.LogInformation("Hello {Target}", "VeryBigStingIWantToTruncateElseKaboomInElasticSearch");
Nicholas Blumhardt
@nblumhardt
@FynZ not directly, AFAIK, but plugging in a custom ILogEventEnricher that walks properties and replaces long string values is fairly straightforward
Magnus Lindhe
@mgnslndh
Hi! Is it possible to log a destructed object as "multiline/formatted" when using a file sink?
1 reply
Joe
@foxjazz
hi, working with dotnet 6 will nuget asp.net 5 work here?
Fynzie
@FynZ

@FynZ not directly, AFAIK, but plugging in a custom ILogEventEnricher that walks properties and replaces long string values is fairly straightforward

I'll have a look then, thanks !

gcalabro-rli
@gcalabro-rli
Can someone tell me details on the ConnectionId property. Curious as to details about what it actually represents. For example, is it a transient identifier, so each new request that is made to an NET 6 API would be a unique value?
minoseah629
@minoseah629

hello, i am experiencing an issue with serilog, iis, sql, and .net framework. i have used serilog with .net 5 microservice and works perfectly. the sql server permissions appear to be fine. i can run locally .net framework solution and target the sql server directly with the connection string.

I have added <section name="MSSqlServerSettingsSection" type="Serilog.Configuration.MSSqlServerConfigurationSection, Serilog.Sinks.MSSqlServer"/> to the web.config.

and lower down in web.config:

<MSSqlServerSettingsSection>

<!-- SinkOptions parameters -->
<BatchPostingLimit Value="150"/>
<BatchPeriod Value="00:00:15"/>

<!-- ColumnOptions parameters -->
<AddStandardColumns>
<add Name="LogEvent"/>
</AddStandardColumns>
<RemoveStandardColumns>
<remove Name="MessageTemplate"/>
</RemoveStandardColumns>
<TimeStamp ConvertToUtc="true"/>
</MSSqlServerSettingsSection>

any ideas what i could try?

alessandroparma
@alessandroparma
HI ALl, I'm Alex and totally new here! I am planning to pen a question on SO but I want to be sure not to write anything silly. I am trying to debug a slinux service in Net6 using serilog but I get no file output when using File Sink. IN Windows works perfectly, in linux (i actually did not try as a standalone app) not at all. I understood it is mainly a problem of permissions so I triend the service out in /srv/monday (monday is the name of the app) giving practically 777 permission to the entire path from srv onward. Centos7 witn no Selinux, user in sudoers, all wiles in the server bacame little by little 777 and now i am desperate....
Is there anybody able to give me a quick checklist os which permissions I should check to have the file correctly defined in the settings /using json appsettings actually)?
AKCore
@AKCore
Is it not possible to log to a console from a winforms background worker?

Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.Async(a => a.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"), blockWhenFull: true)
.WriteTo.Async(b => b.File("log.txt",
rollingInterval:RollingInterval.Day,
rollOnFileSizeLimit:true,
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"), blockWhenFull: true)
.CreateLogger();

This is my setup, but as soon as i start my backgroundworker it doesn't log from it to console. only to file

AKCore
@AKCore
oh it seems like its only logging things in my mainform instead of other forms 0.0
AKCore
@AKCore
any way to solve this?
azsuman
@azsuman
Is Serilog going to stop supporting CouchDB Sinks?
Nicholas Blumhardt
@nblumhardt
Hi @azsuman; the Serilog GitHub organisation no longer includes any projects supporting log servers of any kind, as these have all moved off to be maintained by different groups and organizations who have the knowledge required to work with each server/sink. Serilog's core team know the ins-and-outs of Serilog's internals, .NET fundamentals, filesystems, etc., but can't keep up with the huge ecosystem beyond that. Most active projects have found homes with either the organization producing the log server, or with a dedicated group formed from the maintainers who were active under the Serilog umbrella. Unfortunately, no one's actively maintained the CouchDB sink for a long time, so that project has been archived. If you're keen to revive it and set up a new maintenance team, forking the codebase and publishing updates would be appreciated and encouraged. Let me know if you decide to give it a go!
yuli zorin
@JZorina
Hi everybody! Im using MySql sink in a AWS lambda - all logs is written correctly on a local machine, but not working after deployment - same DB, same connection string - what can be the problem?
also, Serilog printing to the console 'Sending batch of X logs' at the end of a transaction on a local machine - where can i find this print - maybe i will catch the error in that point
Paul Henkin
@henkin
yuli zorin
@JZorina
@henkin yes, still no logs after deployment - no errors from serilog