# How to enable logging for shield?

**URL:** <https://discuss.elastic.co/t/how-to-enable-logging-for-shield/49813>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [May 11, 2016, 6:36pm UTC](https://discuss.elastic.co/t/how-to-enable-logging-for-shield/49813 "2016-05-11T18:36:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Al77056](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Al77056](https://discuss.elastic.co/u/Al77056)\
**Post date:** [May 11, 2016, 6:36pm UTC](https://discuss.elastic.co/t/how-to-enable-logging-for-shield/49813/1 "2016-05-11T18:36:49Z")

</div>

I am installing shield on top of the official docker image of elasticsearch. I was able to setup SSL with basic authentication, and verified that I have access via either chrome or a Python program.

I keep getting 401 errors when I tried to setup access through PKI, and the file elasticserach-access.log under /usr/share/elasticsearch/logs has a 0 file size. How can I enable logging for shield such that I can find out why the PKI client certificates I am using are not authenticated?

---

<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:** [May 12, 2016, 12:51am UTC](https://discuss.elastic.co/t/how-to-enable-logging-for-shield/49813/2 "2016-05-12T00:51:53Z")

</div>

Try adding `shield.authc: DEBUG` to the `logging.yml` configuration file?

---

<div class="post-metadata">

**Author:** ![Al77056](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@Al77056](https://discuss.elastic.co/u/Al77056)\
**Post date:** [May 12, 2016, 12:08pm UTC](https://discuss.elastic.co/t/how-to-enable-logging-for-shield/49813/3 "2016-05-12T12:08:55Z")

</div>

Thanks Mark. Setting shield.authc to DEBUG or TRACE did provided some additional information, such as:  
authenticated user [es\_admin], with roles [[admin]]  
However it does not provide much detail when the authentication failed. Here's what I've tried:

When I execute the following command, I got an error "curl: (51) SSL: no alternative certificate subject name matches target host name 'localhost'", which is expected.  
curl -E client.crt --key client.key --cacert certs/cacert.pem -XGET '[https://localhost:9200](https://localhost:9200)'

When I changed the command to the following with the hostname I specified to create the server certificate:  
curl -E client.crt --key client.key --cacert certs/cacert.pem -XGET '[https://esnode01:9200](https://esnode01:9200)'  
I received a response like the following:

{"error":{"root\_cause":[{"type":"security\_exception","reason":"missing authentic  
ation token for REST request [/]","header":{"WWW-Authenticate":"Basic realm="sh  
ield""}}],"type":"security\_exception","reason":"missing authentication token fo  
r REST request [/]","header":{"WWW-Authenticate":"Basic realm="shield""}},"status":401}

What could be the cause of the error? The DEBUG / TRACE option does not provide any additional information in the logs.

---

<div class="post-metadata">

**Author:** ![Elad\_Benedict](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@Elad\_Benedict](https://discuss.elastic.co/u/Elad_Benedict)\
**Post date:** [August 1, 2016, 6:13am UTC](https://discuss.elastic.co/t/how-to-enable-logging-for-shield/49813/4 "2016-08-01T06:13:31Z")

</div>

I'm having the exact same problem.  
Did you manage to get it working?

@eyaldahari - FYI

---

<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:** [July 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/how-to-enable-logging-for-shield/49813/5 "2017-07-06T13:42:35Z")

</div>


