Skip to content

Commit 4dbccc9

Browse files
committed
Add Windows commands for Log Analysis #9858
1 parent e4e2670 commit 4dbccc9

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

en/docs/monitoring/observability/monitoring-correlation-logs.md

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,15 @@ curl -k "Authorization :Bearer <access-token>" -H "activityid:<example-correlati
682682
2. Isolate the logs that are correlated.<br/>
683683
Replace `<correlation_ID>` with the `<example-correlation-ID>` given above.
684684

685-
`cat correlation.log | grep "<correlation_ID>"`
685+
=== "Linux/Mac OS"
686+
```bash
687+
cat correlation.log | grep "<correlation_ID>"
688+
```
689+
690+
=== "Windows"
691+
```powershell
692+
type correlation.log | findstr "<correlation_ID>"
693+
```
686694

687695
### Reading and analyzing the Correlation logs
688696

@@ -790,30 +798,56 @@ Follow the following steps to pinpoint the bottleneck,
790798

791799
You can list the times consumed by the code level, using the following command. This will help you to pinpoint method level latencies.
792800

793-
``` java
794-
cat correlation.log | grep “|METHOD|| cut -d “|-f4 | sort -n
795-
```
801+
=== "Linux/Mac OS"
802+
```bash
803+
cat correlation.log | grep "|METHOD|" | cut -d "|" -f4 | sort -n
804+
```
805+
806+
=== "Windows"
807+
```powershell
808+
type correlation.log | findstr "|METHOD|" | sort
809+
```
796810

797811
This will give the time consumed by each method in ascending order. If a method with a high time consumption is identified, then take the 5 most time consuming service and database calls, with the same correlation ID of the method logs, and find out the unusually time consuming call.
798812

799-
``` java
800-
cat correlation.log | grep “correlationID” | grep “|HTTP| cut -d “|-f4 | sort -n
801-
cat correlation.log | grep “correlationID” | grep “|jdbc|| cut -d “|-f4 | sort -n
802-
cat correlation.log | grep “correlationID” | grep “|ldap|| cut -d “|-f4 | sort -n
803-
```
813+
=== "Linux/Mac OS"
814+
```bash
815+
cat correlation.log | grep "<correlation_ID>" | grep "|HTTP" | cut -d "|" -f4 | sort -n
816+
cat correlation.log | grep "<correlation_ID>" | grep "|jdbc|" | cut -d "|" -f4 | sort -n
817+
cat correlation.log | grep "<correlation_ID>" | grep "|ldap|" | cut -d "|" -f4 | sort -n
818+
```
819+
820+
=== "Windows"
821+
```powershell
822+
type correlation.log | findstr "<correlation_ID>" | findstr "|HTTP" | sort
823+
type correlation.log | findstr "<correlation_ID>" | findstr "|jdbc|" | sort
824+
type correlation.log | findstr "<correlation_ID>" | findstr "|ldap|" | sort
825+
```
804826

805827
!!! note
806828
If a method with a high time consumption cannot be identified, but still a high latency is observed, the following command can be executed to find the highest time recorded.
807829

808-
``` java
809-
cat correlation.log | cut -d “|” -f4 | sort -n
830+
=== "Linux/Mac OS"
831+
```bash
832+
cat correlation.log | cut -d "|" -f4 | sort -n
833+
```
834+
835+
=== "Windows"
836+
```powershell
837+
type correlation.log | for /f "tokens=4 delims=|" %a in ('more') do @echo %a | sort
810838
```
811839
Then the entry that bears the highest duration can be found by searching the file for this time.
812840

813-
``` java
841+
=== "Linux/Mac OS"
842+
```bash
814843
cat correlation.log | grep "<highest_time>"
815844
```
816845

846+
=== "Windows"
847+
```powershell
848+
type correlation.log | findstr "<highest_time>"
849+
```
850+
817851
!!! tip
818852
Alternatively, a log analyzing tool can be used as well to derive this information.
819853

0 commit comments

Comments
 (0)