# MQTT 503 c8y\_LogFileRequest not working?

**URL:** <https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [April 21, 2023, 8:55am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188 "2023-04-21T08:55:44Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 21, 2023, 8:55am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/1 "2023-04-21T08:55:44Z")

</div>

Hi,  
I m currently working on a device agent using MQTT and want to handle the c8y\_LogFileRequest.C8y v **1015.0.278**  
I have done the step by step approach as explained in topic [here](https://community.cumulocity.com/t/mqtt-c8y-logfilerequest-522-how-to-answer-with-502-or-503/5546/3)

It works as expected except for setting the Operation to Successful:

- My operation is set to executing correctly using `publish("s/us","501,c8y_LogFileRequest")`

- My event is successfully created using a SmartRest template so I receive the event ID back

- The binary is correctly attached to the event

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/b/f/bff36c7639d15b47cb8991a148507f834d2b1ec2.png)

- The url of the binary is correct and return the content of the file
- When I m using ` publish("s/us","503,c8y_LogFileRequest,https://eg-utilities.cumulocity.com/event/events/1359269/binaries")`, my operation is remaining in the Executing state.

Can you please advice on what i m missing?  
thank you

---

<div class="post-metadata">

**Author:** ![Philipp\_Emmel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/philipp_emmel/32/19455_2.png) [@Philipp\_Emmel](https://community.cumulocity.com/u/Philipp_Emmel)\
**Post date:** [April 21, 2023, 9:18am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/2 "2023-04-21T09:18:25Z")

</div>

503 updates the oldest operation of the specified fragment type in status EXECUTING. If you have other older operations still present from earlier testing they will be updated first instead. Could this be the case for you?

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 21, 2023, 9:40am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/3 "2023-04-21T09:40:29Z")

</div>

it s not the case unfortunately.  
As you can see on my screenshot, all my ops were either in success or failed (success when i update via REST api).  
I tried again to execute an operation and as you can see it still remains in executing state, event still I sent the 503.  
Also to double ensure there was not pending operation i run `GET {{url}}/devicecontrol/operations?status=PENDING&deviceId=956200` before sending my LogFileRequest, and there is definitely no operation pending.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/f/d/fd08f2d4a3765f357c80e389a389856bb8d9e02f.png)

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [April 21, 2023, 10:30am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/4 "2023-04-21T10:30:44Z")

</div>

In the screen you’ve posted the Operation is still PENDING not EXECUTING.

Beside that everything looks fine so far. Might sound silly but happened even more then once for me: Are you sure you’re updating the correct device in the correct tenant? It took me sometimes 30 minutes just to figure out I used the wrong tenant ID in my credentials and was wondering why my device wasn’t updated as expected…

Do you receive anything on “s/e”?

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 21, 2023, 10:50am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/5 "2023-04-21T10:50:08Z")

</div>

Indeed it s still pending which means the 501 cmd is not working neither.  
I am definitely updating the correct device since we can see the event being generated with attached binaries on that device.  
I am also printing my device id in that cmd and it s pointing to the correct one.

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 21, 2023, 10:52am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/6 "2023-04-21T10:52:23Z")

</div>

PS: no error msg

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 24, 2023, 8:16am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/7 "2023-04-24T08:16:21Z")

</div>

Should I file a bug for this version of C8Y?

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [April 24, 2023, 9:25am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/9 "2023-04-24T09:25:18Z")

</div>

I tried it with [GitHub - Cumulocity-IoT/cumulocity-devicemanagement-agent: Cumulocity Reference Agent written in Python to demonstrate most of the Device Management Capabilities of Cumulocity IoT](https://github.com/Cumulocity-IoT/cumulocity-devicemanagement-agent) and could not reproduce it.  
All logs are displayed correctly as expected.

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 24, 2023, 9:51am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/10 "2023-04-24T09:51:25Z")

</div>

Did you test on **1015.0.278**?  
See attached my python, it s using a smartResttemplate to get the event id back so we can attach the log file to that event.  
My event has definitely the correct log file attached to it but my operations remains in pending.  
[DeviceLogRequest(1).json.txt](https://community.cumulocity.com/uploads/short-url/ptVFnQbDFRxt4Vj1oabhypuQlNF.txt) (1.2 KB)  
[LogRequest.py.txt](https://community.cumulocity.com/uploads/short-url/uCffjwHW4W5eXt34bABtbtp4nOE.txt) (2.8 KB)

---

<div class="post-metadata">

**Author:** ![Stefan\_Witschel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/stefan_witschel/32/31955_2.png) [@Stefan\_Witschel](https://community.cumulocity.com/u/Stefan_Witschel)\
**Post date:** [April 24, 2023, 10:00am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/11 "2023-04-24T10:00:56Z")

</div>

DM-Agent is working fine on [cumulocity.com](http://cumulocity.com). Will check your implementation.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/7/0/70f1dd890cde3585b79d5cced69b5d6e64f1667d.png)

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [April 24, 2023, 10:02am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/12 "2023-04-24T10:02:51Z")

</div>

Calling template 501 in c8y prod 10.15 sets the operation to executing, no problem.

Then 503,c8y\_LogFileRequest,[https://eg-utilities.cumulocity.com/event/events/1359269/binaries](https://eg-utilities.cumulocity.com/event/events/1359269/binaries) sets it to ‘Successful’ and I see the green tick in the UI.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/3/1/3105ffc911c1f93223235968f5de1fb2a363309d.png)

It would be nice to see your agent log.

For the device you are trying this for - what is the external id in the Identity tab?

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 24, 2023, 10:38am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/13 "2023-04-24T10:38:42Z")

</div>

Hi Robert

type c8y\_Serial  
External ID 123456789UAIAAVDSG

My aggent log is a per below (please note it says operation set to successful because i m sending the 503)

> Agent Start  
> Received operation 522,123456789UAIAAVDSG,Power,2023-04-23T10:46:00+0100,2023-04-24T10:46:00+0100,1000  
> Received operation c8y\_LogFileRequest of type Power  
> Executing c8y\_LogFileRequest  
> Creating event c8y\_Logfile  
> Received operation 413,1403638,Power  
> Event ID 1403638  
> Attaching Power log file…  
> Operation Successfull [https://eg-utilities.cumulocity.com/event/events/1403638/binaries](https://eg-utilities.cumulocity.com/event/events/1403638/binaries)

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/robert_neale/32/31965_2.png) [@Robert\_Neale](https://community.cumulocity.com/u/Robert_Neale)\
**Post date:** [April 24, 2023, 11:07am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/14 "2023-04-24T11:07:12Z")

</div>

Looking at the operation on your tenant it has ‘LogfileRequest’ i.e. lower case ‘f’.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/a/5/a5a7f788b0835b81fb60d12f89f5ead7fda618d7.png)

You are trying to update an operation of type ‘LogFileRequest’ - upper case ‘F’.

Is your REST call that creates the operation creating the incorrect type?

---

<div class="post-metadata">

**Author:** ![Melanie\_Monnereau](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Melanie\_Monnereau](https://community.cumulocity.com/u/Melanie_Monnereau)\
**Post date:** [April 24, 2023, 11:35am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/15 "2023-04-24T11:35:08Z")

</div>

omg that was it! you have a lynx-eyed, I would never have seen it ! thank you

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [October 21, 2023, 11:35am UTC](https://community.cumulocity.com/t/mqtt-503-c8y-logfilerequest-not-working/1188/16 "2023-10-21T11:35:16Z")

</div>

Closed on October 21, 2023, 11:35am UTC

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