# APM Event Logger does not read Flask parameters

**URL:** <https://discuss.elastic.co/t/apm-event-logger-does-not-read-flask-parameters/313433>\
**Category:** Elasticsearch\
**Created:** [September 1, 2022, 10:49am UTC](https://discuss.elastic.co/t/apm-event-logger-does-not-read-flask-parameters/313433 "2022-09-01T10:49:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![papers\_hive](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@papers\_hive](https://discuss.elastic.co/u/papers_hive)\
**Post date:** [September 1, 2022, 10:49am UTC](https://discuss.elastic.co/t/apm-event-logger-does-not-read-flask-parameters/313433/1 "2022-09-01T10:49:07Z")

</div>

I am running a flask application with apm as an agent.

I have configured my app as the following initially:

```python
app = Flask( __name__ )
APM_DICTIONARY = {
            'SERVICE_NAME': 'MY_SERVICE_NAME' ,
            'SERVER_URL': 'MY_URL'
            'SECRET_TOKEN': 'MY_TOKEN'
}   
 app.config['ELASTIC_APM'] = APM_DICTIONARY
 apm.init_app(app)

```

So far everything worked fine, but on a particular function that has a bigger body than others this error happens:

`elasticapm.transport.exceptions.TransportException: HTTP 400: {"accepted":69,"errors":[{"message":"event exceeded the permitted size."`

So I checked for some documentation and i ended up [Configuration | APM Python Agent Reference [6.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html)

I noticed the parameter `API_REQUEST_SIZE` and I started tuning it. I used respectively:  
1mb, 10mb, 100mb, 1gb, 10gb and 100gb. None of them worked, and I'm quite sure the size of the whole body would hardly exceed the 1mb.  
Then I also tried to tune the `LOG_LEVEL` as I do not really want apm to log every single event. So in the end my configuration looked as:

```python
app = Flask( __name__ )
APM_DICTIONARY = {
            'SERVICE_NAME': 'MY_SERVICE_NAME' ,
            'SERVER_URL': 'MY_URL'
            'SECRET_TOKEN': 'MY_TOKEN',
            'API_REQUEST_SIZE': '10gb',
            'LOG_LEVEL': 'error'
}   
 app.config['ELASTIC_APM'] = APM_DICTIONARY
 apm.init_app(app)

```

Though, whatever the `LOG_LEVEL` and the `API_REQUEST_SIZE` nothing seems to actually affect apm.

My first question is: how can I ensure that the parameters are not ignored? But mostly, how do I make apm **not** logging all the events, but only logging events when I want it through `apm.capture_message`?

On a side note, I noticed the following: [APM agent crashes if the SQL query is too large · Issue #827 · elastic/apm-agent-python · GitHub](https://github.com/elastic/apm-agent-python/issues/827)

---

<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 29, 2022, 10:49am UTC](https://discuss.elastic.co/t/apm-event-logger-does-not-read-flask-parameters/313433/2 "2022-09-29T10:49:13Z")

</div>

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