feat(srql): search devices by availability #566

Closed
opened 2026-03-28 04:25:49 +00:00 by mfreeman451 · 1 comment
Owner

Imported from GitHub.

Original GitHub issue: #1772
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/issues/1772
Original created: 2025-10-15T05:05:49Z


in field_mapping.ml we can expose the availability fields from the sweeper service or others:

Currently:

    let apply_entity_mapping f =
      match entity_lc with
      | "devices" -> (
          match f with
          | "name" | "host" | "device_name" -> "hostname"
          | "ip_address" | "ipaddress" | "device.ip" -> "ip"
          | "mac_address" | "macaddress" | "device.mac" -> "mac"
          | "uid" | "device.uid" -> "device_id"
          | "domain" | "device_domain" -> "device_domain"
          | "site" | "location" | "device_location" -> "device_location"
          | "os.name" | "device.os.name" -> "device_os_name"
          | "os.version" | "device.os.version" -> "device_os_version"
          | _ when String.contains f '.' ->
              let lf = lc f in
              if String.length lf > 3 && String.sub lf 0 3 = "os." then
                "device_os_" ^ String.sub lf 3 (String.length lf - 3)
              else if String.length lf > 12 && String.sub lf 0 12 = "observables." then
                "observables_" ^ String.sub lf 12 (String.length lf - 12)
              else String.map (fun c -> if c = '.' then '_' else c) f
          | _ -> f)
Imported from GitHub. Original GitHub issue: #1772 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/issues/1772 Original created: 2025-10-15T05:05:49Z --- in `field_mapping.ml` we can expose the availability fields from the sweeper service or others: Currently: ```ocaml let apply_entity_mapping f = match entity_lc with | "devices" -> ( match f with | "name" | "host" | "device_name" -> "hostname" | "ip_address" | "ipaddress" | "device.ip" -> "ip" | "mac_address" | "macaddress" | "device.mac" -> "mac" | "uid" | "device.uid" -> "device_id" | "domain" | "device_domain" -> "device_domain" | "site" | "location" | "device_location" -> "device_location" | "os.name" | "device.os.name" -> "device_os_name" | "os.version" | "device.os.version" -> "device_os_version" | _ when String.contains f '.' -> let lf = lc f in if String.length lf > 3 && String.sub lf 0 3 = "os." then "device_os_" ^ String.sub lf 3 (String.length lf - 3) else if String.length lf > 12 && String.sub lf 0 12 = "observables." then "observables_" ^ String.sub lf 12 (String.length lf - 12) else String.map (fun c -> if c = '.' then '_' else c) f | _ -> f) ```
Author
Owner

Imported GitHub comment.

Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/issues/1772#issuecomment-3409404137
Original created: 2025-10-16T06:41:37Z


closed, this functionality already exists

Imported GitHub comment. Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/issues/1772#issuecomment-3409404137 Original created: 2025-10-16T06:41:37Z --- closed, this functionality already exists
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar#566
No description provided.