# Elasticsearch cloud does not receive logs from Serilog

**URL:** https://discuss.elastic.co/t/elasticsearch-cloud-does-not-receive-logs-from-serilog/349452
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [December 15, 2023, 12:47pm UTC](https://discuss.elastic.co/t/elasticsearch-cloud-does-not-receive-logs-from-serilog/349452 "2023-12-15T12:47:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Zsombor\_Veres-Lakos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zsombor_veres-lakos/32/130053_2.png) [@Zsombor\_Veres-Lakos](https://discuss.elastic.co/u/Zsombor_Veres-Lakos)
#### Post date: [December 15, 2023, 12:47pm UTC](https://discuss.elastic.co/t/elasticsearch-cloud-does-not-receive-logs-from-serilog/349452/1 "2023-12-15T12:47:02Z")

</div>

Yesterday I was trying to set minimal privileges for Apikey, so I built a dummy logging application.

I used that application from 10:00-19:00 and then the Elastic search stopped showing logs. Since yesterday 19:00 **I am unable to get the any logs from the exact same application.**

C# code:

```auto
using System;
using Elastic.Ingest.Elasticsearch;
using Elastic.Ingest.Elasticsearch.DataStreams;
using Elastic.Serilog.Sinks;
using Serilog;
using Serilog.Core;
using Serilog.Events;

class Program
{
    static async Task Main()
    {
        var loggerConfig = new LoggerConfiguration()
            .MinimumLevel.Verbose()
            .WriteTo.Console()
            .WriteTo.File("logs/myapp.txt", rollingInterval: RollingInterval.Day);

        var apiKey = "SECRET";
        loggerConfig.WriteTo.ElasticCloud(
            "CLOUD_ID",
            apiKey,
            opts =>
            {

                opts.DataStream = new DataStreamName(
                        "type",
                        "dataset",
                        "namespace");
                opts.BootstrapMethod = BootstrapMethod.Failure;
                opts.MinimumLevel = LogEventLevel.Information;
            },
                    levelSwitch: new LoggingLevelSwitch()
                );

        Log.Information($"Hello, {apiKey} {DateTime.UtcNow.Second}!");
        Log.Error($"Hello, {apiKey} {DateTime.UtcNow.Second}!");
        Log.Debug($"Hello, {apiKey} {DateTime.UtcNow.Second}!");
        Log.Fatal($"Hello, {apiKey} {DateTime.UtcNow.Second}!");
        Log.Warning($"Hello, {apiKey} {DateTime.UtcNow.Second}!");
        Log.Information("Hello, world!");
        using var l = loggerConfig.CreateLogger();
        Log.Logger = l;

        var str = "a";
        for (int i = 0; i < 1000; i++)
        {
            str += i;
            str += "\n";
        }

        Log.Information(str);

        int a = 10, b = 0;
        try
        {
            Log.Debug("Dividing {A} by {B}", a, b);
            Console.WriteLine(a / b);
        }
        catch (Exception ex)
        {
            Log.Error(ex, "Something went wrong");
        }
        finally
        {
            await Log.CloseAndFlushAsync();
        }
    }
}

```

The connection is made between my application and Elasticsearch, since Index template is created, but I cannot display logs on discovery page.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 12, 2024, 12:47pm UTC](https://discuss.elastic.co/t/elasticsearch-cloud-does-not-receive-logs-from-serilog/349452/2 "2024-01-12T12:47:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
