Nov 29 2017
11:24 AM
- last edited on
Apr 07 2022
04:49 PM
by
TechCommunityAP
Nov 29 2017
11:24 AM
- last edited on
Apr 07 2022
04:49 PM
by
TechCommunityAP
Hi,
I am working one of the customer enterprise environment azure cloud automation tasks. From azure perspective past couple of days working and trying to setup alert Management in OMS. We are using log search query to validate initially and then create relevant alerts. I am able to see some issues in Linux configuration file tracking . I enabled counter for Linux file tracking as per the screenshot and manually tested the query in log search either particular file or computer based, i can able to see the modified file details in output report. But my customer want to monitor and track all the configuration file changes. So i tried to set below mentioned query with particular path with file extension it's not working. i am not sure which operator to use for here.
Could you please someone help me to resolve the issue. it will be very helpful for me and everyone. Thanks for advance and i am expecting good solution.
planning to track : /etc/*.conf
query not working :
1) ConfigurationChange | where FileSystemPath =~ "/etc/*.conf"
2) ConfigurationChange | where ( ConfigChangeType == "Files" ) | where ( ChangeCategory == "Modified" ) | where FileSystemPath ??? "/etc/*.conf" - choosing operator
Thanks
Jags
Nov 29 2017 10:29 PM - edited Nov 29 2017 10:30 PM
SolutionHi You will have to use string operators: https://docs.loganalytics.io/docs/Language-Reference/Scalar-operators/String-operators You can use matches regex but that might be not easy to solve if you do not know regex.
ConfigurationChange | where FileSystemPath startswith "/etc/" and FileSystemPath endswith ".conf"
This should probably will allow you to scope to those specific files
Nov 30 2017 12:33 PM
Hi Stainslav,
Thanks for providing information.
if i use your query i can able to get .conf file changes. But it's collecting from entire path available directory files(/etc/other directory). But we are looking the file changes till next directory, not other directory (/etc/dir1/dir2/dir3/dir4/files). it means (/etc/dir1/).
Let me know any solution available on this.
Thanks
Jagadish
Nov 30 2017 11:13 PM
Hi
I am not sure I understand what you are saying. Can you provide more details?
Dec 01 2017 05:48 AM
Hi Stainslav,
Apologies for misunderstanding.
I need to monitor the file changes only to next level of directory, which are in etc. For example: /etc/(azure)*.conf - any modification done in azure.conf, alert need to be triggered.
Query should not pick any other directories apart from /etc/.
Thanks,
Jagadish
Thanks
Dec 01 2017 07:53 AM
Hi
I am still not sure if I get the scenario right but let me know if this works:
let test1 = datatable(Path:string) [ "/etc/auzre.conf", "/etc/azure/azure.conf", "/etc/bla/bla.conf", "/etc/bla/sadasd/bla.conf" ]; test1 | where Path matches regex "^/etc/([^/]+)$"
Nov 29 2017 10:29 PM - edited Nov 29 2017 10:30 PM
SolutionHi You will have to use string operators: https://docs.loganalytics.io/docs/Language-Reference/Scalar-operators/String-operators You can use matches regex but that might be not easy to solve if you do not know regex.
ConfigurationChange | where FileSystemPath startswith "/etc/" and FileSystemPath endswith ".conf"
This should probably will allow you to scope to those specific files