# Pmm-agent - log rotation

**URL:** <https://forums.percona.com/t/pmm-agent-log-rotation/27002>\
**Category:** PMM 2.x\
**Created:** [December 7, 2023, 12:05pm UTC](https://forums.percona.com/t/pmm-agent-log-rotation/27002 "2023-12-07T12:05:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariaczi](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@mariaczi](https://forums.percona.com/u/mariaczi)\
**Post date:** [December 7, 2023, 12:05pm UTC](https://forums.percona.com/t/pmm-agent-log-rotation/27002/1 "2023-12-07T12:05:35Z")

</div>

Hello.  
I want to rotate logs from pmm-agent.  
Based on documentation: [pmm-agent - PMM Client agent - Percona Monitoring and Management](https://docs.percona.com/percona-monitoring-and-management/details/commands/pmm-agent.html#logging)

> If you change the default log file name, reflect the change in the log rotation rules file `/etc/logrotate.d/pmm-agent-logrotate`.

I’m not have this file. I had installed agent from binaries. I’m looked inside deb and rpm packages too for this file, but I not found it.

Which type of signal I can send to pmm-agent process to re-create (re-handle) new log file?  
I don’t want restart the pmm-agent.

Actually I use:

```auto
ProjectName: pmm-agent
Version: 2.33.0
PMMVersion: 2.33.0
Timestamp: 2022-12-06 17:15:45 (UTC)
FullCommit: 1cc0dd29c13ca7a8fd0ea16760af48b8eba890b6

```

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [December 7, 2023, 12:20pm UTC](https://forums.percona.com/t/pmm-agent-log-rotation/27002/2 "2023-12-07T12:20:04Z")

</div>

Hi @mariaczi,  
pmm-agent don’t create log files.  
pmm-agent logs to stdout and stderr, so you can configure where to write logs when you start the process.

---

<div class="post-metadata">

**Author:** ![mariaczi](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@mariaczi](https://forums.percona.com/u/mariaczi)\
**Post date:** [December 7, 2023, 1:00pm UTC](https://forums.percona.com/t/pmm-agent-log-rotation/27002/3 "2023-12-07T13:00:24Z")

</div>

Hi @nurlan.  
Thanks for your answer.  
I’m starting pmm-agent with `start-stop-daemon` command in this way:

```auto
start() {

        ebegin "Starting ${name}"
        start-stop-daemon \
                --start --quiet --background --pidfile ${pidfile} -1 ${pmm_log} -2 ${pmm_log} \
                --exec ${command} -- ${start_stop_daemon_args}
        local ret=$?
        eend $ret
        return $ret
}

```

What I should send to `start-stop-daemon` command to re-create log file?

---

<div class="post-metadata">

**Author:** ![nurlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nurlan/32/1523_2.png) [@nurlan](https://forums.percona.com/u/nurlan)\
**Post date:** [December 8, 2023, 12:19pm UTC](https://forums.percona.com/t/pmm-agent-log-rotation/27002/4 "2023-12-08T12:19:46Z")

</div>

Hi @mariaczi,

You need to configure start-stop-daemon to write from stdout to some file([How to log the stdout of a process started by start-stop-daemon – iTecNote](https://itecnote.com/tecnote/r-how-to-log-the-stdout-of-a-process-started-by-start-stop-daemon/)) and then configure logrotate to rotate this file like it’s written here [How to Setup and Manage Log Rotation Using Logrotate in Linux](https://www.tecmint.com/install-logrotate-to-manage-log-rotation-in-linux/)

I hope it’ll help you.

P.S. Regarding

> If you change the default log file name, reflect the change in the log rotation rules file `/etc/logrotate.d/pmm-agent-logrotate` .

We will remove this line from our documentation, it seems outdated.
