# I can not send logs to elastic cloud

**URL:** <https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411>\
**Category:** Elasticsearch\
**Created:** [November 4, 2021, 12:57pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411 "2021-11-04T12:57:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hugo\_Pacini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugo_pacini/32/96717_2.png) [@Hugo\_Pacini](https://discuss.elastic.co/u/Hugo_Pacini)\
**Post date:** [November 4, 2021, 12:57pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411/1 "2021-11-04T12:57:06Z")

</div>

I'm trying to send logs from Serilogs to Elastic Cloud but doesn't work and I can not see errors. Can I send logs to test using Postman?

The URL is [https://my-custom-domain.es.eastus2.azure.elastic-cloud.com:9243](https://my-custom-domain.es.eastus2.azure.elastic-cloud.com:9243)

```auto
var uri = new Uri(configuration["ElasticSearchUrl"]);
            var sinkOptions = new ElasticsearchSinkOptions(uri)
            {
                AutoRegisterTemplate = true,
                ModifyConnectionSettings = x => x.BasicAuthentication(configuration["ElasticUser"], configuration["ElasticPass"]),
                IndexFormat = $"custom-log-{Assembly.GetExecutingAssembly().GetName().Name.ToLower().Replace('.', '-')}-{DateTime.Now:yyyy-MM}",
            };
            
            Log.Logger = new LoggerConfiguration()
                .ReadFrom.Configuration(configuration)
                .Enrich.FromLogContext()
                .Enrich.WithMachineName()
                .WriteTo.Console()
                .WriteTo.Elasticsearch(sinkOptions)
                .Enrich.WithProperty("Environment", env)
                .CreateLogger();

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 4, 2021, 11:02pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411/2 "2021-11-04T23:02:07Z")

</div>

Welcome to our community! 😃

You can use postman to test, yes.  
If there's no output from serilog then it's going to be very hard to provide any sort of assistance unfortunately.

---

<div class="post-metadata">

**Author:** ![Hugo\_Pacini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugo_pacini/32/96717_2.png) [@Hugo\_Pacini](https://discuss.elastic.co/u/Hugo_Pacini)\
**Post date:** [November 5, 2021, 6:57pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411/3 "2021-11-05T18:57:09Z")

</div>

I cannot see any error in the vs console. Where can I see it? For that reason, I ask if there is a way to check that endpoint works well with the postman. Maybe do a post for that elastic URI and given index in order to check if the problem is about the Serilog and not credentials or the endpoint.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 5, 2021, 8:16pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411/4 "2021-11-05T20:16:27Z")

</div>

@Hugo_Pacini Welcome to the community!

You can certainly try a POST.

Remember Elasticsearch expects JSON, you don't need the port 9243 either

### POST application/json

```auto
curl -u "username:password" -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST "https://my-custom-domain.es.eastus2.azure.elastic-cloud.com/indexname/_doc"

```

with a data file

```auto
curl -u "username:password" -d "@data.json" -H "Content-Type: application/json" -X POST "https://my-custom-domain.es.eastus2.azure.elastic-cloud.com/indexname/_doc"

```

---

<div class="post-metadata">

**Author:** ![Hugo\_Pacini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugo_pacini/32/96717_2.png) [@Hugo\_Pacini](https://discuss.elastic.co/u/Hugo_Pacini)\
**Post date:** [November 6, 2021, 1:19pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411/5 "2021-11-06T13:19:00Z")

</div>

> [@stephenb](#):
>
> `es.eastus2.azure.elastic-cloud.com`

@stephenb Thanks for your answer. I've tried tested as you say but I always get a 401 with the following response. I've tested with all combinations "user:password" that I could. Just to know, I use the same credentials that I use to log in to the cloud.

```auto
{"error":{"root_cause":[{"type":"security_exception","reason":"unable to authenticate user [username@domain] for REST request [/my-index/_doc]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}}],"type":"security_exception","reason":"unable to authenticate user [username@domain] for REST request [/my-index/_doc]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}},"status":401}

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [November 6, 2021, 2:16pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411/6 "2021-11-06T14:16:55Z")

</div>

Well that's your problem.. the cluster credentials are not the same as the Cloud Console credentials.

A 401 confirms that because that is the code for not authorized

When you created the cluster a dialog box popped up with the cluster credentials You should have copied that and that would be what you would use for interaction with Elasticsearch..

If you do not have that set of credentials which will be `elastic` and a `password` You can reset it using the instructions here

> **[Reset the elastic user password | Elasticsearch Service Documentation | Elastic](https://www.elastic.co/guide/en/cloud/current/ec-password-reset.html)**

---

<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:** [December 4, 2021, 2:17pm UTC](https://discuss.elastic.co/t/i-can-not-send-logs-to-elastic-cloud/288411/7 "2021-12-04T14:17:57Z")

</div>

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