salopensource / sal

Modular reporting for Endpoints
Apache License 2.0
213 stars 64 forks source link

search with two 'conditional' yields no record #290

Open jokdbx opened 6 years ago

jokdbx commented 6 years ago

i am trying to setup a search in sal for a custom condition we have defined, and for os_version_minor to a specific version. It looks like if i use a fact and a condition in my search, things are found, but if i use two stacked conditions, it doesn't yield any results.

first block:
 searchitem: Condition
 searchfield: kextcount
 operator: <
 searchterm: 7
second block:
 and/or: AND
 searchitem: Condition
 searchfield: os_vers_minor
 operator: =
 searchterm: 13
grahamgilbert commented 6 years ago

This is where to look https://github.com/salopensource/sal/blob/master/search/views.py#L108

grahamgilbert commented 6 years ago

Who wants this one? I’m about to go on paternity so I’m not going to get to start it. @jokdbx do you want to attempt this?

jokdbx commented 6 years ago

I will try to look at it...

pptrvv670 commented 2 years ago

I'm interested in getting this issue fixed. I do scripting, but not really programming. Looking at the code pointed out by Graham looks like something I might be able to figure out. I'd at least like to try. A few questions to help me get started.

  1. Is it precisely line 108 that is the issue? Or is the issue likely to be on that page?
  2. It's been quite some time since that issue was reported on. Is the error still likely on this page?

What is the best way to troubleshoot this? I have SAL running in Docker and I created a pgadmin Docker instance so I can look at the database.

I figured the first thing I'd want to do is look at the SQL Query that gets submitted for a search with multiple Conditions to see if the SQL Query is right and the output is wrong, or if the SQL Query is wrong to begin with.

How would I do that? What tools would I need, and would they need to be installed in Docker or on a local machine. I have SAL running in Docker on a Linux Virtual Machine. Docker is not running on my Linux workstation.

I'd really like to understand how to diagnose programs rather than individual scripts in hopes of being able to contribute.

Thanks for the great program.

grahamgilbert commented 2 years ago

It’s roughly around that area as my best guess. The dev setup is documented at https://github.com/salopensource/sal/wiki/Developer-Installation

pptrvv670 commented 2 years ago

I followed the directions and got SAL setup along with a client to report in. However, there is a problem with the installation. When you go to create a search, everything looks normal until you change 'Search Item' from 'Machine', then nothing is populated in 'Search Field'. If you reselect 'Machine', the 'Search Field' remains empty. The 'search_searchfieldcache' table is empty. This is after a munki and SAL run.