diff --git a/frontend/src/modals/bellcloud/devices/DeleteDeviceLogsModal.jsx b/frontend/src/modals/bellcloud/devices/DeleteDeviceLogsModal.jsx
new file mode 100644
index 0000000..b0a3534
--- /dev/null
+++ b/frontend/src/modals/bellcloud/devices/DeleteDeviceLogsModal.jsx
@@ -0,0 +1,175 @@
+// frontend/src/modals/bellcloud/devices/DeleteDeviceLogsModal.jsx
+// Health tab → Logs → "Delete Logs…". Permanently deletes console-stored log
+// history for one device, filtered by log type (and by level for the text
+// channels). Unlike ResetStatsModal this never touches the device itself,
+// Firestore stats, boot history or ping/diagnostics data — just the log
+// channels shown in the Logs explorer.
+//
+// Device Logs / Info → DELETE /mqtt/logs/{serial}?source=…&level=…
+// Alerts / Heartbeats / Commands → POST /devices/{id}/reset-stats (existing)
+
+import { useState } from 'react'
+import Modal from '@/components/ui/Modal'
+import Button from '@/components/ui/Button'
+import PressHoldButton from '@/components/ui/PressHoldButton'
+import Icon from '@/components/ui/Icon'
+import api from '@/lib/api'
+import { useToast } from '@/components/ui/Toast'
+
+const TYPES = [
+ { key: 'log', label: 'Device Logs', description: 'Debug log lines the firmware streams over MQTT.', leveled: true },
+ { key: 'info', label: 'Info events', description: 'System info events (playback started, config changes, …).', leveled: true },
+ { key: 'alert_history', label: 'Alert history', description: 'Past alert transitions. Current active alerts are kept.' },
+ { key: 'heartbeats', label: 'Heartbeats', description: 'Heartbeat history — also empties the RSSI and free-heap charts on Overview.' },
+ { key: 'commands', label: 'Commands', description: 'Sent-command history (also shown in the Control tab).' },
+]
+
+const LEVELS = ['INFO', 'WARN', 'ERROR']
+
+function CheckRow({ label, description, checked, onChange, disabled }) {
+ return (
+
+ )
+}
+
+export default function DeleteDeviceLogsModal({ open, onClose, onDeleted, deviceId, serial }) {
+ const { toast } = useToast()
+ const [types, setTypes] = useState({ log: true, info: true, alert_history: false, heartbeats: false, commands: false })
+ const [levels, setLevels] = useState({ INFO: true, WARN: true, ERROR: true })
+ const [running, setRunning] = useState(false)
+
+ const textSources = ['log', 'info'].filter(k => types[k])
+ const selectedLevels = LEVELS.filter(l => levels[l])
+ const allLevels = selectedLevels.length === LEVELS.length
+ const tableKeys = ['alert_history', 'heartbeats', 'commands'].filter(k => types[k])
+ const canRun = (textSources.length > 0 && selectedLevels.length > 0) || tableKeys.length > 0
+
+ const handleClose = () => { if (!running) onClose() }
+
+ const run = async () => {
+ setRunning(true)
+ const done = []
+ const failed = []
+ if (textSources.length > 0 && selectedLevels.length > 0) {
+ const params = new URLSearchParams()
+ textSources.forEach(s => params.append('source', s))
+ if (!allLevels) selectedLevels.forEach(l => params.append('level', l))
+ try {
+ const res = await api.delete(`/mqtt/logs/${encodeURIComponent(serial)}?${params}`)
+ done.push(`${res?.deleted ?? 0} log line(s)`)
+ } catch (err) {
+ failed.push(`logs: ${err.message || 'failed'}`)
+ }
+ }
+ if (tableKeys.length > 0) {
+ const body = Object.fromEntries(tableKeys.map(k => [k, true]))
+ try {
+ const res = await api.post(`/devices/${deviceId}/reset-stats`, body)
+ for (const k of tableKeys) {
+ const label = TYPES.find(t => t.key === k).label.toLowerCase()
+ done.push(`${res?.[k] ?? 0} ${label}`)
+ }
+ } catch (err) {
+ failed.push(`${tableKeys.join(', ')}: ${err.message || 'failed'}`)
+ }
+ }
+ setRunning(false)
+ if (failed.length === 0) {
+ toast.success('Logs deleted', `Removed ${done.join(', ')}.`)
+ } else {
+ toast.danger('Delete incomplete', failed.join(' · '))
+ }
+ onDeleted?.()
+ onClose()
+ }
+
+ return (
+
+
+
+
+
+ Permanently deletes the selected history for {serial} from the console database. The device's own SD-card logs are not affected. This cannot be undone.
+
+