# Custom Logs integration with variable file path?

**URL:** <https://discuss.elastic.co/t/custom-logs-integration-with-variable-file-path/358508>\
**Category:** Elastic Agent\
**Created:** [April 30, 2024, 5:04pm UTC](https://discuss.elastic.co/t/custom-logs-integration-with-variable-file-path/358508 "2024-04-30T17:04:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbrasee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbrasee/32/123737_2.png) [@jbrasee](https://discuss.elastic.co/u/jbrasee)\
**Post date:** [April 30, 2024, 5:04pm UTC](https://discuss.elastic.co/t/custom-logs-integration-with-variable-file-path/358508/1 "2024-04-30T17:04:44Z")

</div>

I'm using a Fleet Agent with Custom Logs integration, but the path to the log file is dynamic and dependent on the name of the agent host -- so I have "C:\logs\${host.hostname}\elastic\*.log" as the log file path. However, when I try to use a variable in the path like this, it fails to initialize it. Is this the correct format for including a variable in the path? It works perfectly when I use a static path like "C:\logs\my\_host\_name\elastic\*.log".

With the ${host.hostname} variable in use, I only see in the filebeat logs are the default log files being configured, but no errors about my custom path.

```auto
[elastic_agent.filebeat][info] Configured paths: [C:\var\log\auth.log* C:\var\log\secure*]
[elastic_agent.filebeat][info] Configured paths: [C:\var\log\messages* C:\var\log\syslog* C:\var\log\system*]

```

Here's what my Custom Logs integration looks like:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/a/faf0afb655afba1a4a4dd6745109bb5f40b09fb1.png)

This is on Elastic v8.13.2. Thanks!

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [May 23, 2024, 7:41am UTC](https://discuss.elastic.co/t/custom-logs-integration-with-variable-file-path/358508/2 "2024-05-23T07:41:14Z")

</div>

> [@jbrasee](#):
>
> I'm using a Fleet Agent with Custom Logs integration, but the path to the log file is dynamic and dependent on the name of the agent host -- so I have "C:\logs${host.hostname}\elastic\*.log" as the log file path. However, when I try to use a variable in the path like this, it fails to initialize it. Is this the correct format for including a variable in the path? It works perfectly when I use a static path like "C:\logs\my\_host\_name\elastic\*.log".
> 
> With the ${host.hostname} variable in use, I only see in the filebeat logs are the default log files being configured, but no errors about my custom path.
> 
> ```auto
> [elastic_agent.filebeat][info] Configured paths: [C:\var\log\auth.log* C:\var\log\secure*]
> [elastic_agent.filebeat][info] Configured paths: [C:\var\log\messages* C:\var\log\syslog* C:\var\log\system*]
> 
> ```

Hi,

probably the Elastic Agent does not support the use of variables like ${host.hostname} in the file paths for the Custom Logs integration.

If all your logs are in subdirectories of `C:\logs\` , you could use a path like `C:\logs\*\elastic*.log` to collect all matching log files from all subdirectories.

Regards
