<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Not Getting anything Back When Querying Server Logs Using ArcGIS API for Python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596637#M11234</link>
    <description>&lt;P&gt;Thanks Cody! so what would be the side effects of changing the&amp;nbsp;&lt;SPAN&gt;maxHistory&amp;nbsp; to 0? Is this a good idea on PROD?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Mar 2025 16:31:34 GMT</pubDate>
    <dc:creator>BHK</dc:creator>
    <dc:date>2025-03-18T16:31:34Z</dc:date>
    <item>
      <title>Not Getting anything Back When Querying Server Logs Using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596190#M11225</link>
      <description>&lt;P&gt;I am trying to get ArcGIS Server logs using&amp;nbsp;ArcGIS API for Python form this page&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/latest/guide/managing-your-gis-servers/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/latest/guide/managing-your-gis-servers/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am using this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import datetime
import pandas as pd
now = datetime.datetime.now()
start_time = now - datetime.timedelta(days=10)

recent_logs = server1.logs.query(start_time = start_time)
#print a message as a sample
recent_logs['logMessages'][0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I am not getting anything!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BHK_0-1742229286502.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128054i49D2A27885A42B31/image-size/large?v=v2&amp;amp;px=999" role="button" title="BHK_0-1742229286502.png" alt="BHK_0-1742229286502.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;but I am able to access to log setting&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BHK_1-1742229494741.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128055i6F7B33774AFB61C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="BHK_1-1742229494741.png" alt="BHK_1-1742229494741.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;printing out the `&lt;SPAN&gt;recent_logs` return this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BHK_0-1742229968583.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128059i834B4229127487D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="BHK_0-1742229968583.png" alt="BHK_0-1742229968583.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;while `&lt;SPAN&gt;start_time` is this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BHK_1-1742230070271.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128060i1BB660CB23DE334E/image-size/large?v=v2&amp;amp;px=999" role="button" title="BHK_1-1742230070271.png" alt="BHK_1-1742230070271.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Can you please let me know why this is happening and how I fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 16:48:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596190#M11225</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2025-03-17T16:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Not Getting anything Back When Querying Server Logs Using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596242#M11228</link>
      <description>&lt;P&gt;In your image, logMessages is an empty list, hence the index error message&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;recent_logs['logMessages'][0]&lt;/P&gt;&lt;P&gt;from the recent_logs dictionary with the 'logMessages' key, it is empty so trying to get the first (that is&amp;nbsp; [0] )&lt;/P&gt;&lt;P&gt;will return a key.&lt;/P&gt;&lt;P&gt;To avoid the error you would have to check its length, then if there any, get the first&lt;/P&gt;&lt;P&gt;msgs =&amp;nbsp;recent_logs['logMessages']&lt;/P&gt;&lt;LI-CODE lang="python"&gt;msgs = recent_logs['logMessages']
if len(msgs) &amp;gt; 0:
    first = msgs[0]
    print("first message {}".format(first))
else:
    print("no messages")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 17:49:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596242#M11228</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-03-17T17:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Not Getting anything Back When Querying Server Logs Using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596260#M11229</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/671830"&gt;@BHK&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know this may not be the entire answer, but something that I noticed. In your screenshot of the working logs.settings, it states that your maxHistory is 1, which means that it is only keeping the logs for 1 single day. You may try sorting the logs instead of within 10 days, to 10 hours/1 day to see if it's pulling anything correctly. I'll continue looking through to see if there's anything I can test on my side to get this replicated!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 18:32:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596260#M11229</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-03-17T18:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Not Getting anything Back When Querying Server Logs Using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596637#M11234</link>
      <description>&lt;P&gt;Thanks Cody! so what would be the side effects of changing the&amp;nbsp;&lt;SPAN&gt;maxHistory&amp;nbsp; to 0? Is this a good idea on PROD?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 16:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1596637#M11234</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2025-03-18T16:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Not Getting anything Back When Querying Server Logs Using ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1597177#M11235</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/671830"&gt;@BHK&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Changing maxHistory to 0 will cause all history to be indefinitely kept, this may be negligible space now, but may result in a significant amount of data being held after a long while. Depending on your log settings, if they log at the Info or Debug, you could end up with hundreds or thousands a day.&lt;/P&gt;&lt;P&gt;I would personally set the history time at 15, maybe even 30, to keep 15 and 30 days. That would be my recommendation, and I have mine set up to 30 in prod!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 16:33:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-getting-anything-back-when-querying-server/m-p/1597177#M11235</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-03-19T16:33:39Z</dc:date>
    </item>
  </channel>
</rss>

