# Could not send logs to a UDP server (AccessControlException)

**URL:** <https://discuss.elastic.co/t/could-not-send-logs-to-a-udp-server-accesscontrolexception/194881>\
**Category:** Elasticsearch\
**Created:** [August 12, 2019, 3:53pm UTC](https://discuss.elastic.co/t/could-not-send-logs-to-a-udp-server-accesscontrolexception/194881 "2019-08-12T15:53:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jazz/32/6943_2.png) [@jazz](https://discuss.elastic.co/u/jazz)\
**Post date:** [August 12, 2019, 3:53pm UTC](https://discuss.elastic.co/t/could-not-send-logs-to-a-udp-server-accesscontrolexception/194881/1 "2019-08-12T15:53:18Z")

</div>

I'm trying to configure Elasticsearch to output logs to an UDP server, but it fails with the `AccessControlException`. Here is the log:

```auto
main ERROR An exception occurred processing Appender logstash java.security.AccessControlException: access denied ("java.net.SocketPermission" "192.168.x.x:12201" "connect,resolve")
        at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
        at java.base/java.security.AccessController.checkPermission(AccessController.java:1042)
        at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)
        at java.base/java.lang.SecurityManager.checkConnect(SecurityManager.java:910)
        at java.base/java.net.DatagramSocket.send(DatagramSocket.java:674)
        at org.apache.logging.log4j.core.net.DatagramOutputStream.flush(DatagramOutputStream.java:103)
        at org.apache.logging.log4j.core.appender.OutputStreamManager.flushDestination(OutputStreamManager.java:275)
[...]

```

Here is the relevant part of log4j2.properties:

```auto
appender.logstash.type = Socket
appender.logstash.name = logstash
appender.logstash.host = 192.168.x.x
appender.logstash.port = 12201
appender.logstash.protocol = UDP
appender.logstash.layout.type = GelfLayout

```

Should I set a custom security policy?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [August 12, 2019, 4:45pm UTC](https://discuss.elastic.co/t/could-not-send-logs-to-a-udp-server-accesscontrolexception/194881/2 "2019-08-12T16:45:37Z")

</div>

There isn't currently a supported way to do this. How are you adding the gelf appender jar? I assume dropping it into Elasticsearch's `lib` directory? Adding a system level policy should work then, since ES will merge that with its own policy.

However, note that long term we have plans to [restrict which jars exist](https://github.com/elastic/elasticsearch/issues/29177) for the core system, but allow for this use case by providing a way to have [additional jars loaded by plugins](https://github.com/elastic/elasticsearch/issues/29306) in the root classloader.

---

<div class="post-metadata">

**Author:** ![jazz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jazz/32/6943_2.png) [@jazz](https://discuss.elastic.co/u/jazz)\
**Post date:** [August 12, 2019, 5:25pm UTC](https://discuss.elastic.co/t/could-not-send-logs-to-a-udp-server-accesscontrolexception/194881/3 "2019-08-12T17:25:18Z")

</div>

> [@rjernst](#):
>
> How are you adding the gelf appender jar? I assume dropping it into Elasticsearch's `lib` directory?

I did not add it, I assumed it would work out of the box, and it seems that it works because I do not see any error beside the security exception.

---

<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:** [September 9, 2019, 5:25pm UTC](https://discuss.elastic.co/t/could-not-send-logs-to-a-udp-server-accesscontrolexception/194881/4 "2019-09-09T17:25:19Z")

</div>

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