# .ulg file maximum size?

**URL:** <https://discuss.px4.io/t/ulg-file-maximum-size/29081>\
**Category:** PX4 Autopilot\
**Created:** [September 19, 2022, 11:38am UTC](https://discuss.px4.io/t/ulg-file-maximum-size/29081 "2022-09-19T11:38:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jph](https://discuss.px4.io/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jph](https://discuss.px4.io/u/jph)\
**Post date:** [September 19, 2022, 11:38am UTC](https://discuss.px4.io/t/ulg-file-maximum-size/29081/1 "2022-09-19T11:38:26Z")

</div>

Hi

We had the .ulg log file stop after 5.5 hours into a 8 hour flight. The log file size was 2 097 152 KB, there was no successive log for the remainder of the flight. Is there a maximum .ulg log file size? Running 1.12 based firmware with an 8 Gb SD card.  
There is no mention of in [ULog File Format | PX4 Guide (main)](https://docs.px4.io/main/en/dev_log/ulog_file_format.html), and [Logging | PX4 Guide (main)](https://docs.px4.io/main/en/dev_log/logging.html) places emphasis on write speed.  
[Parameter Reference | PX4 Guide (main)](https://docs.px4.io/main/en/advanced_config/parameter_reference.html#sd-logging) SDLOG\_PROFILE references “The default allows for general log analysis while keeping the log file size reasonably small.”  
Is there a guide for what is reasonably small?

---

<div class="post-metadata">

**Author:** ![bkueng](https://discuss.px4.io/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bkueng](https://discuss.px4.io/u/bkueng)\
**Post date:** [September 19, 2022, 4:25pm UTC](https://discuss.px4.io/t/ulg-file-maximum-size/29081/2 "2022-09-19T16:25:21Z")

</div>

Hi

The 5.5h with 2GB file means 101KB/s logging rate. Is this with the default profile? I expect it to be around 40KB/s.  
The maximum file size depends on the file system and OS, and the 2GB is apparently the size limit on NuttX, although it could go to 4GB.

Generally for this long flight hours we should further reduce the logging rate, as we don’t need high-rate sensor data.

---

<div class="post-metadata">

**Author:** ![jph](https://discuss.px4.io/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jph](https://discuss.px4.io/u/jph)\
**Post date:** [September 20, 2022, 5:23am UTC](https://discuss.px4.io/t/ulg-file-maximum-size/29081/3 "2022-09-20T05:23:58Z")

</div>

Thanks for the reply.

For the PX4 functions we are using SDLOG\_PROFILE as 1 (the default set ), but we also have many more custom log messages which we are including so the logging rate is reasonable for us.

How would it be possible to split the log file into a further file after a file size of 2GB? In the short term what is the NuttX parameter to set the size limit to 4GB?

---

<div class="post-metadata">

**Author:** ![jph](https://discuss.px4.io/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jph](https://discuss.px4.io/u/jph)\
**Post date:** [September 23, 2022, 1:34pm UTC](https://discuss.px4.io/t/ulg-file-maximum-size/29081/4 "2022-09-23T13:34:37Z")

</div>

And to follow up we also got the logging rate down to 50KB/s, so up to max 11 hours flight time with a 2 GB limit.

---

<div class="post-metadata">

**Author:** ![kevindsp](https://discuss.px4.io/user_avatar/discuss.px4.io/kevindsp/32/5192_2.png) [@kevindsp](https://discuss.px4.io/u/kevindsp)\
**Post date:** [March 24, 2023, 7:57am UTC](https://discuss.px4.io/t/ulg-file-maximum-size/29081/5 "2023-03-24T07:57:02Z")

</div>

Is there any possibility to make the ulg file close just before 2GB and then open a new ulg file to continue until the flight is over?

---

<div class="post-metadata">

**Author:** ![bkueng](https://discuss.px4.io/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bkueng](https://discuss.px4.io/u/bkueng)\
**Post date:** [June 8, 2023, 7:54am UTC](https://discuss.px4.io/t/ulg-file-maximum-size/29081/6 "2023-06-08T07:54:11Z")

</div>

I added logic to restart on any error: [logger: restart on file write error by bkueng · Pull Request #21389 · PX4/PX4-Autopilot · GitHub](https://github.com/PX4/PX4-Autopilot/pull/21389)
