Skip to content

Commit

Permalink
Improve Linux SysLog Support (#3)
Browse files Browse the repository at this point in the history
Updates the Linux logging story so that it can collect all the same logs as Windows (now including the ETW events). Also adds some info as to how to collect logs for a repro.
  • Loading branch information
nibanks authored Nov 5, 2019
1 parent 41c63b3 commit 17b6663
Show file tree
Hide file tree
Showing 7 changed files with 405 additions and 352 deletions.
16 changes: 16 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\S

- Run `..\artifacts\bin\Release\msquictest.exe`

### Collecting logs

- To start a trace, run `netsh trace start overwrite=yes report=dis correlation=dis traceFile=quic.etl maxSize=1024 provider={ff15e657-4f26-570e-88ab-0796b258d11c} level=0x5`
- Run the repro.
- To stop the trace, run `netsh trace stop`
- To decode the `quic.etl` file, run **TODO**

## Building on Linux (or [WSL](https://docs.microsoft.com/en-us/windows/wsl/wsl2-install))

- Run `mkdir bld && cd bld`
Expand All @@ -37,3 +44,12 @@ reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\S
### Running the tests

- Run `../artifacts/bin/msquictest`

### Collecting logs

On Linux, MsQuic uses [syslog](http://man7.org/linux/man-pages/man3/syslog.3.html) for logging by default. To view the logs:

- On **WSL**, run `sudo service rsyslog start` to make sure syslog is configured.
- **Optionally**, run `sudo truncate -s 0 /var/log/syslog` to clear out the current log file.
- Run the repro.
- You can view the logs from the `/var/log/syslog` file.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(QUIC_CXX_FLAGS "${QUIC_C_FLAGS}")
else()
# Custom build flags.
set(QUIC_C_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_STUB -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -pthread")
set(QUIC_CXX_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_STUB -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-reorder -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -Wno-sign-compare -Wno-format --std=c++0x -g -pthread")
set(QUIC_C_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_SYSLOG -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -pthread")
set(QUIC_CXX_FLAGS "-DQUIC_PLATFORM_LINUX -DQUIC_EVENTS_SYSLOG -DQUIC_LOGS_SYSLOG -fms-extensions -fPIC -Wall -Wno-reorder -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-value -Wno-sign-compare -Wno-format --std=c++0x -g -pthread")
endif()

include_directories(${CMAKE_SOURCE_DIR}/inc)
Expand Down
5 changes: 5 additions & 0 deletions core/inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,8 @@ QuicConnGetDestCidFromSeq(
_In_ QUIC_VAR_INT SequenceNumber,
_In_ BOOLEAN RemoveFromList
);

uint8_t
QuicPacketTraceType(
_In_ const QUIC_SENT_PACKET_METADATA* Metadata
);
24 changes: 1 addition & 23 deletions inc/quic_platform_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,33 +66,11 @@ void
typedef
void
(*QUIC_LOG)(
_In_ QUIC_LOG_LEVEL Level,
_In_ const char* File,
_In_ int Line,
_In_ const char* Func,
_In_ QUIC_TRACE_LEVEL Level,
_In_ const char* Fmt,
_In_ va_list args
);

typedef
void
(*QUIC_LOG_ASSERT)(
_In_z_ const char* File,
_In_ int Line,
_In_z_ const char* Func,
_In_z_ const char* Expr
);

typedef
void
(*QUIC_TRACE_LOGGING_WRITE)(
_In_ const char* EventName,
_In_ const char* File,
_In_ int Line,
_In_ const char* Func
);


typedef
QUIC_RECV_DATAGRAM*
(*QUIC_DATAPATH_RECVCONTEXT_TO_RECVBUFFER)(
Expand Down
455 changes: 291 additions & 164 deletions inc/quic_trace.h

Large diffs are not rendered by default.

Loading

0 comments on commit 17b6663

Please sign in to comment.