# Is config-profiling-inferred-spans-lib-directory always respected?

**URL:** <https://discuss.elastic.co/t/is-config-profiling-inferred-spans-lib-directory-always-respected/258810>\
**Category:** APM\
**Tags:** java, elastic-agent\
**Created:** [December 16, 2020, 7:25am UTC](https://discuss.elastic.co/t/is-config-profiling-inferred-spans-lib-directory-always-respected/258810 "2020-12-16T07:25:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giovere](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@giovere](https://discuss.elastic.co/u/giovere)\
**Post date:** [December 16, 2020, 7:25am UTC](https://discuss.elastic.co/t/is-config-profiling-inferred-spans-lib-directory-always-respected/258810/1 "2020-12-16T07:25:11Z")

</div>

Kibana: 7.8.1  
APM-server: 7.8.1  
Elasticsearch: 7.8.1  
Java agent: 1.19.0

By default async-profiler writes to `/tmp`, but since our `/tmp` is tiny and it gets filled very quickly, I wanted to change this directory to something else using [config-profiling-inferred-spans-lib-directory](https://www.elastic.co/guide/en/apm/agent/java/current/config-profiling.html#config-profiling-inferred-spans-lib-directory) in java agent, but we are still getting a lot of files in `/tmp`:

- apm-activation-events-\*.bin
- apm-traces-\*.jfr

Questions:

1. Is this expected behavior and `config-profiling-inferred-spans-lib-directory` comes into the play only when `/tmp` is not executable?
2. Is there maybe some other way to change async-profiler's tmp directory?
3. Is there some policy managing how frequently (or when) those temporary files are supposed to be cleand-up?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [December 16, 2020, 8:31am UTC](https://discuss.elastic.co/t/is-config-profiling-inferred-spans-lib-directory-always-respected/258810/2 "2020-12-16T08:31:29Z")

</div>

Hi @giovere

1. this is expected behavior, as this configuration parameter only controls where the async-profiler binaries will be stored for cases when you can't have executables in `/tmp`.
2. agent should use the configured JVM temporary directory, thus using something like `-Djava.io.tmpdir=/another/path/for/tmp`.
3. Not directly on the files themselves as their size depends on application code and activity. But it's influenced by async profiler parameters, for example reducing the sampling interval with [`profiling_inferred_spans_sampling_interval`](https://www.elastic.co/guide/en/apm/agent/java/current/config-profiling.html#config-profiling-inferred-spans-sampling-interval) might be an option to explore.

Thus, in your case, you should probably set the `java.io.tmpdir` and use a dedicated temporary directory.

---

<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 6, 2021, 4:31am UTC](https://discuss.elastic.co/t/is-config-profiling-inferred-spans-lib-directory-always-respected/258810/3 "2021-01-06T04:31:29Z")

</div>

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