{"id":5026,"date":"2026-08-18T08:23:27","date_gmt":"2026-08-18T08:23:27","guid":{"rendered":"https:\/\/www.hackmosphere.fr\/ai-logging-what-to-log\/"},"modified":"2026-09-11T09:34:13","modified_gmt":"2026-09-11T09:34:13","slug":"ai-logging-what-to-log","status":"publish","type":"post","link":"https:\/\/www.hackmosphere.fr\/en\/ai-logging-what-to-log\/","title":{"rendered":"AI Logging: What to Log"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text admin_label=&#8221;Text&#8221; _builder_version=&#8221;4.27.8&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<p>Most enterprise logging architectures were designed for deterministic applications: a user logs in, performs an action, and the log records who, what, and when. A generative AI system or an <a href=\"https:\/\/www.hackmosphere.fr\/en\/?p=5395\">autonomous agent<\/a> breaks this simple model. The \u201cwhat\u201d becomes a natural-language prompt\u2014which may be modified during the session by an injection\u2014and the \u201cwho\u201d can be a chain of delegation involving a user, an agent, and the tools that the agent, in turn, invokes. Most current logging stacks do not capture any of these specific elements.   <\/p>\n<h2 class=\"wp-block-heading\"><strong>Logging: What Is It?<\/strong><\/h2>\n<p>Before examining what AI is changing, we must return to the standard definition in France. The CNIL describes a <a href=\"https:\/\/www.cnil.fr\/sites\/cnil\/files\/atoms\/files\/recommandation_-_journalisation.pdf\">logging system<\/a> as the recording, in log files, of three categories of events: users\u2019 business activities (application logs), technical interventions\u2014including those by administrators\u2014and security-related anomalies and events (technical or \u201csystem\u201d logs). <\/p>\n<p>Its recommendation of October 14, 2021 (<a href=\"https:\/\/www.legifrance.gouv.fr\/jorf\/id\/JORFTEXT000044272396\">Resolution No. 2021-122<\/a>) specifies the purpose of these mechanisms: to ensure the traceability of access and actions by users authorized to access information systems and, consequently, of the processing of personal data carried out within those systems. In other words, to know who accessed which data, on which system, and at what time. This record-keeping is not merely an optional best practice: it directly contributes to compliance with the security principle set forth in Articles 5 and 32 of <a href=\"https:\/\/www.hackmosphere.fr\/en\/?p=5527\">the GDPR<\/a>.  <\/p>\n<p>According to the CNIL, this data is used to detect and investigate incidents, intrusions, or misuse by an authorized individual. A log is not a compliance document to be archived; it is an investigative tool. <\/p>\n<p>The CNIL recommends that log data be subject to automated analysis to enable the rapid detection of unauthorized use. Simply storing the data is not enough, and this requirement was already established in 2021, well before the AI Act. <\/p>\n<p>This definition was developed for deterministic processing, where the authorized user and the logged action are two clearly identifiable entities. It is precisely this pairing that generative AI systems and autonomous agents blur, which is why a log stack compliant with the CNIL framework may remain structurally unaware of what an agent is actually executing. <\/p>\n<h2 class=\"wp-block-heading\"><strong>What the EU AI Act Actually Requires<\/strong><\/h2>\n<p><a href=\"https:\/\/artificialintelligenceact.eu\/fr\/article\/12\/\">Article 12<\/a> of <a href=\"https:\/\/www.hackmosphere.fr\/en\/eu-ai-act-the-complete-guide-for-businesses-in-2026\/\">the EU AI Regulation<\/a> requires that high-risk AI systems have technical capabilities that enable the automatic logging of relevant events throughout their entire lifecycle. These capabilities must ensure a level of traceability appropriate to the system\u2019s purpose, in particular to identify situations that may pose a risk, to facilitate post-market surveillance, and to enable the deployer to monitor the system\u2019s operation. <\/p>\n<p><a href=\"https:\/\/artificialintelligenceact.eu\/fr\/article\/19\/\">Article 19 requires <\/a>the provider to retain automatically generated logs under its control for a period appropriate to the purpose of the system, of at least six months, unless Union law or national law provides for a different or longer period. Specific sector-based rules may also apply, particularly in the field of financial services. <\/p>\n<p><a href=\"https:\/\/artificialintelligenceact.eu\/fr\/article\/18\/\">Article 18<\/a> establishes a separate obligation: the supplier must make the technical documentation and several other conformity documents available to the competent national authorities for a period of ten years from the date the system is placed on the market or put into service. It is therefore incorrect to calculate this period from the date the system is withdrawn from the market. <\/p>\n<p>Calendar-related note: The initial schedule did not provide for uniform implementation across all high-risk systems as of August 2, 2026. The Digital Omnibus on AI, definitively adopted by the Council on June 29, 2026, establishes, among other things, a deadline of December 2, 2027, for high-risk AI systems covered by Article 6(2) and Annex III, as well as a deadline of August 2, 2028, for systems covered by Article 6(1) and Annex I. <\/p>\n<p>This postponement does not negate the importance of implementing a structured and proportionate logging system now: it is a measure to prepare for compliance, oversight, and a potential audit, rather than an additional obligation explicitly imposed by Section 12 prior to the applicable deadline.<\/p>\n<h2 class=\"wp-block-heading\"><strong>What an AI log must contain<\/strong><\/h2>\n<p>Most traditional application logging stacks capture an HTTP request, an authenticated user, and a return code. This is insufficient for an AI system. A usable log must include:  <\/p>\n<ul class=\"wp-block-list\">\n<li><strong>The complete identity of the action chain<\/strong>: the user or system that initiated the request, the agent that processed it, and any tools or subagents invoked in sequence.<span>Traceability of this delegation requires that each link in the chain have its <\/span><a href=\"https:\/\/www.hackmosphere.fr\/en\/ai-powered-access-and-identity-management-securing-your-api-keys\/\">own identity and a dedicated API key<\/a><\/li>\n<li><strong>The prompt and the response<\/strong>; or, for use cases where the full content is too sensitive to be stored in plain text, a hash that allows it to be reconstructed or verified without storing the source data<\/li>\n<li><strong>The status of the applied policy<\/strong>: Which filtering or control rules were active at the time of the interaction (an aspect that most current architectures overlook, even though it is essential for establishing that a control was indeed in effect at the time of the incident)<\/li>\n<li><strong>The data or databases consulted<\/strong>\u2014particularly for a RAG system\u2014and the sources that contributed to the generated response, to enable tracing a hallucination or an error back to its source<\/li>\n<li><strong>The timestamp and period of use<\/strong>, with integrity protected against any subsequent modification (cryptographic signature or chaining of records).<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\"><strong>Why the integrity of the log is just as important as its content<\/strong><\/h2>\n<p>A log that can be modified retroactively has no evidentiary value in the event of an investigation or regulatory audit. The most robust architectures follow an <em>\u201cappend-only\u201d<\/em> principle (additions only, with no possibility of retroactive modification) and include protection against tampering, such as cryptographic signatures or certified timestamps. It is this level of rigor that distinguishes a simple application log file from audit evidence that is defensible before a regulatory authority.  <\/p>\n<h2 class=\"wp-block-heading\"><strong>Use logs for investigations, not just store them<\/strong><\/h2>\n<p>A large volume of logs that is stored but cannot be analyzed is of no use when it matters most. Two uses must be anticipated from the design phase: <\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Near-real-time anomaly detection<\/strong>: identifying agent behavior that deviates from its usual scope (access to unusual systems, abnormal query volume) before an incident escalates.<\/li>\n<li><strong>Post-incident reconstruction<\/strong>: In the event of a confirmed incident, be able to quickly answer three questions: <strong>What data was exposed, through which path, and from which initial identity<\/strong>. This capability depends entirely on the level of detail in the fields captured at the time of the interaction; it cannot be reconstructed afterward if the logs are too sparse. <\/li>\n<\/ul>\n<p>For agents connected to external tools via connectors, each tool call must be logged as a separate event\u2014not just the initial interaction with the model\u2014otherwise, visibility into what the agent actually executed on behalf of the user will be lost.<\/p>\n<h2 class=\"wp-block-heading\"><strong>FAQ: AI Logging, AI Logs, Agent Traceability, and the AI Act<\/strong><\/h2>\n<p>[\/et_pb_text][et_pb_accordion _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_accordion_item title=&#8221;Should all prompts and responses be kept in plain text?&#8221; open=&#8221;on&#8221; _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]Not necessarily. For the most sensitive exchanges, a cryptographic fingerprint combined with separate encrypted storage makes it possible to verify the integrity of an exchange without exposing its content to anyone with access to the logs.[\/et_pb_accordion_item][et_pb_accordion_item title=&#8221;Is a six-month retention period sufficient for all purposes?&#8221; _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; open=&#8221;off&#8221;]<\/p>\n<p>This is a regulatory minimum, not a recommended maximum. The financial and healthcare sectors, as well as sectors subject to specific record-keeping requirements, generally must retain these logs for a longer period, in accordance with their existing sector-specific obligations. <\/p>\n<p>[\/et_pb_accordion_item][et_pb_accordion_item title=&#8221;Does an AI-powered SaaS provider automatically generate logs for me?&#8221; _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; open=&#8221;off&#8221;]No, the retention obligation remains the responsibility of the deployer under Article 26, regardless of the system provider. It is essential to verify contractually that you have actual access to the provider\u2019s logs before considering this obligation to be fulfilled.[\/et_pb_accordion_item][\/et_pb_accordion][et_pb_text _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h2 class=\"wp-block-heading\"><strong>  Organizing Logging for Your AI Systems<\/strong><\/h2>\n<p>Our experts assess your current logging coverage and assist in implementing a log architecture that is compliant and useful for investigations, <span>consistent with your <\/span><a href=\"https:\/\/www.hackmosphere.fr\/en\/ai-governance-in-the-enterprise-the-2026-ciso-cio-guide\/\">AI governance<\/a><span> and your overall <\/span><a href=\"https:\/\/www.hackmosphere.fr\/en\/?p=4983\">AI security<\/a><span> strategy <\/span><span>.<\/span><\/p>\n<p>Would you like to discuss your project or assess your needs?  <a href=\"https:\/\/www.hackmosphere.fr\/en\/contact\/\" data-type=\"page\" data-id=\"1780\">Contact our experts.<\/a><\/p>\n<p>[\/et_pb_text][et_pb_code _builder_version=&#8221;4.27.8&#8243; _module_preset=&#8221;default&#8221; theme_builder_area=&#8221;post_content&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<script type=\"application\/ld+json\"><!-- [et_pb_line_break_holder] -->{<!-- [et_pb_line_break_holder] -->  \"@context\": \"https:\/\/schema.org\",<!-- [et_pb_line_break_holder] -->  \"@type\": \"FAQPage\",<!-- [et_pb_line_break_holder] -->  \"mainEntity\": [<!-- [et_pb_line_break_holder] -->    {<!-- [et_pb_line_break_holder] -->      \"@type\": \"Question\",<!-- [et_pb_line_break_holder] -->      \"name\": \"Faut-il conserver l\u2019int\u00e9gralit\u00e9 des prompts et r\u00e9ponses en clair ?\",<!-- [et_pb_line_break_holder] -->      \"acceptedAnswer\": {<!-- [et_pb_line_break_holder] -->        \"@type\": \"Answer\",<!-- [et_pb_line_break_holder] -->        \"text\": \"Pas n\u00e9cessairement. Pour les \u00e9changes les plus sensibles, une empreinte cryptographique associ\u00e9e \u00e0 un stockage chiffr\u00e9 s\u00e9par\u00e9 permet de prouver l\u2019int\u00e9grit\u00e9 d\u2019un \u00e9change sans exposer son contenu \u00e0 toute personne ayant acc\u00e8s aux journaux.\"<!-- [et_pb_line_break_holder] -->      }<!-- [et_pb_line_break_holder] -->    },<!-- [et_pb_line_break_holder] -->    {<!-- [et_pb_line_break_holder] -->      \"@type\": \"Question\",<!-- [et_pb_line_break_holder] -->      \"name\": \"Six mois de r\u00e9tention suffisent-ils pour tous les usages ?\",<!-- [et_pb_line_break_holder] -->      \"acceptedAnswer\": {<!-- [et_pb_line_break_holder] -->        \"@type\": \"Answer\",<!-- [et_pb_line_break_holder] -->        \"text\": \"C\u2019est un plancher r\u00e9glementaire, pas un plafond recommand\u00e9. Les secteurs financiers, de sant\u00e9 ou soumis \u00e0 des obligations documentaires sp\u00e9cifiques doivent g\u00e9n\u00e9ralement conserver ces journaux plus longtemps, en coh\u00e9rence avec leurs obligations sectorielles existantes.\"<!-- [et_pb_line_break_holder] -->      }<!-- [et_pb_line_break_holder] -->    },<!-- [et_pb_line_break_holder] -->    {<!-- [et_pb_line_break_holder] -->      \"@type\": \"Question\",<!-- [et_pb_line_break_holder] -->      \"name\": \"Un fournisseur SaaS int\u00e9grant de l\u2019IA journalise-t-il automatiquement pour moi ?\",<!-- [et_pb_line_break_holder] -->      \"acceptedAnswer\": {<!-- [et_pb_line_break_holder] -->        \"@type\": \"Answer\",<!-- [et_pb_line_break_holder] -->        \"text\": \"Non, l\u2019obligation de conservation reste \u00e0 la charge du d\u00e9ployeur au titre de l\u2019article 26, quel que soit le fournisseur du syst\u00e8me. V\u00e9rifier contractuellement l\u2019acc\u00e8s effectif aux journaux du fournisseur est indispensable avant de consid\u00e9rer cette obligation comme couverte.\"<!-- [et_pb_line_break_holder] -->      }<!-- [et_pb_line_break_holder] -->    }<!-- [et_pb_line_break_holder] -->  ]<!-- [et_pb_line_break_holder] -->}<!-- [et_pb_line_break_holder] --><\/script>[\/et_pb_code][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most enterprise logging architectures were designed for deterministic applications: a user logs in, performs an action, and the log records who, what, and when. A generative AI system or an autonomous agent breaks this simple model. The \u201cwhat\u201d becomes a natural-language prompt\u2014which may be modified during the session by an injection\u2014and the \u201cwho\u201d can be [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5024,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_titles_title":"Logging for AI Systems: Compliance with the AI Act and the GDPR","_seopress_titles_desc":"GDPR, AI Act, AI agents, prompts, and logs: Learn how to set up an effective audit trail to strengthen your compliance.","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"","_seopress_redirections_param":"","_seopress_redirections_type":0,"_seopress_analysis_target_kw":"","_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[46],"tags":[],"class_list":["post-5026","post","type-post","status-publish","format-standard","has-post-thumbnail","category-other"],"_links":{"self":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/comments?post=5026"}],"version-history":[{"count":15,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5026\/revisions"}],"predecessor-version":[{"id":5836,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/posts\/5026\/revisions\/5836"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/media\/5024"}],"wp:attachment":[{"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/media?parent=5026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/categories?post=5026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hackmosphere.fr\/en\/wp-json\/wp\/v2\/tags?post=5026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}