SOLVED

Directory Search in ConfigurationChange

%3CLINGO-SUB%20id%3D%22lingo-sub-163512%22%20slang%3D%22en-US%22%3EDirectory%20Search%20in%20ConfigurationChange%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-163512%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20having%20an%20issue%20searching%20in%20ConfigurationChange%20against%20directories%20across%20workspaces.%3C%2FP%3E%0A%3CP%3EWhen%20I%20run%20my%20initial%20query%20in%20only%20one%20workspace%20I%20am%20able%20to%20get%20results%20back%20on%20what%20changes%20were%20made%20within%20those%20directories%20(see%20screenshot%201%2C%20also%20below).%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3Esearch%20in%20(ConfigurationChange)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E(%40%22%2Fvar%2Fadm%22%20or%20%40%22%2Fetc%2F*.conf%22)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EResults%20yield%20changes%20to%20%3CSTRONG%3E%2Fvar%2Fadm%2Fmount%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHow%20can%20I%20do%20this%20across%20workspaces%3F%20I%20am%20starting%20off%20with%20this%20in%20the%20query%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3Eunion%20workspace('workspace1').ConfigurationChange%2C%20workspace('workspace2').ConfigurationChange%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20tried%20adding%20%22search%20in%22%20between%20union%20and%20workspace%20but%20it%20errors%20out%2C%20played%20with%20the%20parentheses%20as%20well%20and%20no%20luck.%20Is%20there%20a%20way%20to%20do%20this%20where%20it%20would%20look%20like%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3Eunion%20workspace('workspace1').ConfigurationChange%2C%20workspace('workspace2').ConfigurationChange%26nbsp%3B%7C%20where%20FileSystemPath%20%40%22%2Fvar%2Fadm%22%26nbsp%3B%3C%2FSTRONG%3E%26nbsp%3B%20--%26gt%3B%20Essentially%20trying%20to%20replicate%20the%20query%20above%20where%20it%20searches%20that%20specified%20directory%2Fpath.%3C%2FP%3E%0A%3CP%3EPretty%20much%20everything%20I%20tried%20doesn't%20work%20out.%20Any%20suggestions%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3ESean%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-163512%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQuery%20Language%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-165211%22%20slang%3D%22en-US%22%3ERe%3A%20Directory%20Search%20in%20ConfigurationChange%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-165211%22%20slang%3D%22en-US%22%3E%3CP%3EYep%2C%20that's%20what%20I%20was%20looking%20for%2C%20thanks%20again!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-165206%22%20slang%3D%22en-US%22%3ERe%3A%20Directory%20Search%20in%20ConfigurationChange%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-165206%22%20slang%3D%22en-US%22%3E%3CP%3EOk.%20Than%20may%20be%20this%20way.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Eunion%20workspace('workspace1').ConfigurationChange%2C%20workspace('workspace2').ConfigurationChange%20%20%7C%20where%20*%20has%20%40%22%2Fvar%2Fadm%22%20or%20*%20has%20%40%22%2Fetc%2F*.conf%22%3C%2FPRE%3E%0A%3CP%3EReference%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.loganalytics.io%2Fdocs%2FLanguage-Reference%2FTabular-operators%2Fsearch-operator%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.loganalytics.io%2Fdocs%2FLanguage-Reference%2FTabular-operators%2Fsearch-operator%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-165188%22%20slang%3D%22en-US%22%3ERe%3A%20Directory%20Search%20in%20ConfigurationChange%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-165188%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20info.%20So%20when%20trying%20this%20out%20with%20the%20method%20below%2C%20it%20does%20not%20yield%20any%20results%2C%20however%2C%20when%20I%20do%20it%20with%20%22search%20in%22%20that%20is%20able%20to%20grab%20any%20activity%20within%20that%20directory.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20doing%3A%3C%2FP%3E%0A%3CPRE%3EConfigurationChange%20%7C%20where%20FileSystemPath%20%3D%3D%20%40%22%2Fvar%2Fadm%22%20or%20FileSystemPath%20%3D%3D%20%40%22%2Fetc%2F*.conf%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3BI%20think%20this%20only%20targets%20the%20name%20of%20the%20path%20and%20nothing%20actually%20under%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhere%20as%20when%20I%20search%3A%20%3C%2FP%3E%0A%3CPRE%3Esearch%20in%20(ConfigurationChange)%0A(%40%22%2Fvar%2Fadm%22%20or%20%40%22%2Fetc%2F*.conf%22)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3BI%20am%20able%20to%20see%20activity%20related%20to%20%3CSTRONG%3EFileSystemPath%3C%2FSTRONG%3E%20about%20%3CSTRONG%3E%2Fvar%2Fadm%2Fmount.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIs%20it%20possible%20to%20yield%20the%20results%20I%20am%20looking%20for%20using%20the%20query%20you%20suggested%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%2C%3C%2FP%3E%0A%3CP%3ESean%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-164886%22%20slang%3D%22en-US%22%3ERe%3A%20Directory%20Search%20in%20ConfigurationChange%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-164886%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%0A%3CP%3EWhen%20you%20work%20with%20the%20query%20language%26nbsp%3Balmost%20never%20use%20search.%20It%20is%20always%20better%20to%20reference%20the%20table%20directly%20instead.%3C%2FP%3E%0A%3CP%3ESo%20instead%20of%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Esearch%20in%20(ConfigurationChange)%0A(%40%22%2Fvar%2Fadm%22%20or%20%40%22%2Fetc%2F*.conf%22)%3C%2FPRE%3E%0A%3CP%3Edo%3A%3C%2FP%3E%0A%3CPRE%3EConfigurationChange%20%7C%20where%20FileSystemPath%20%3D%3D%20%40%22%2Fvar%2Fadm%22%20or%20FileSystemPath%20%3D%3D%20%40%22%2Fetc%2F*.conf%22%3C%2FPRE%3E%0A%3CP%3EAssuming%20that%20you%20know%20you%20want%20to%20search%20in%20ConfigurationChange%20table%20and%20FileSystemPath%20rule.%3C%2FP%3E%0A%3CP%3ENotice%20also%20because%20you%20are%20not%20using%20syntax%20the%20filtering%20is%20changed%20as%20well.%3C%2FP%3E%0A%3CP%3EBecause%20of%20that%20when%20using%20union%20your%20query%20should%20be%20something%20like%20this%3A%3C%2FP%3E%0A%3CPRE%3Eunion%20workspace('workspace1').ConfigurationChange%2C%20workspace('workspace2').ConfigurationChange%20%7C%20where%20FileSystemPath%20%3D%3D%20%40%22%2Fvar%2Fadm%22%20%3C%2FPRE%3E%0A%3CP%3EHope%20this%20explains%20it%20and%20works.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I'm having an issue searching in ConfigurationChange against directories across workspaces.

When I run my initial query in only one workspace I am able to get results back on what changes were made within those directories (see screenshot 1, also below).

search in (ConfigurationChange)

(@"/var/adm" or @"/etc/*.conf")

Results yield changes to /var/adm/mount

 

How can I do this across workspaces? I am starting off with this in the query:

union workspace('workspace1').ConfigurationChange, workspace('workspace2').ConfigurationChange

 

I tried adding "search in" between union and workspace but it errors out, played with the parentheses as well and no luck. Is there a way to do this where it would look like the following:

union workspace('workspace1').ConfigurationChange, workspace('workspace2').ConfigurationChange | where FileSystemPath @"/var/adm"   --> Essentially trying to replicate the query above where it searches that specified directory/path.

Pretty much everything I tried doesn't work out. Any suggestions?

 

Regards,

Sean

4 Replies

Hi

When you work with the query language almost never use search. It is always better to reference the table directly instead.

So instead of 

search in (ConfigurationChange)
(@"/var/adm" or @"/etc/*.conf")

do:

ConfigurationChange | where FileSystemPath == @"/var/adm" or FileSystemPath == @"/etc/*.conf"

Assuming that you know you want to search in ConfigurationChange table and FileSystemPath rule.

Notice also because you are not using syntax the filtering is changed as well.

Because of that when using union your query should be something like this:

union workspace('workspace1').ConfigurationChange, workspace('workspace2').ConfigurationChange | where FileSystemPath == @"/var/adm" 

Hope this explains it and works.

Thanks for the info. So when trying this out with the method below, it does not yield any results, however, when I do it with "search in" that is able to grab any activity within that directory.

 

When doing:

ConfigurationChange | where FileSystemPath == @"/var/adm" or FileSystemPath == @"/etc/*.conf

 I think this only targets the name of the path and nothing actually under it.

 

Where as when I search:

search in (ConfigurationChange)
(@"/var/adm" or @"/etc/*.conf")

 I am able to see activity related to FileSystemPath about /var/adm/mount.

 

Is it possible to yield the results I am looking for using the query you suggested?

 

Thanks,

Sean

Best Response confirmed by Stanislav Zhelyazkov (MVP)
Solution

Ok. Than may be this way.

 

union workspace('workspace1').ConfigurationChange, workspace('workspace2').ConfigurationChange  | where * has @"/var/adm" or * has @"/etc/*.conf"

Reference: https://docs.loganalytics.io/docs/Language-Reference/Tabular-operators/search-operator

 

Yep, that's what I was looking for, thanks again!