From 7fe0607a66bced0d0beb6754a8b8e0ce79f69259 Mon Sep 17 00:00:00 2001 From: Szymon Bialkowski <54031852+sbialkowski-r7@users.noreply.github.com> Date: Mon, 30 Nov 2020 10:31:03 +0000 Subject: [PATCH] LOG-15585 Replace legacy ingestion endpoint (#60) --- .gitignore | 6 +++- src/LogentriesCore/LeClient.cs | 32 ++++++++---------- src/LogentriesCore/LogentriesCore.csproj | 27 ++++++++++----- src/LogentriesCore/LogentriesCore.nuspec | 21 ++++++++++++ src/LogentriesCore/Properties/AssemblyInfo.cs | 6 ++-- src/LogentriesCore/packages.config | 1 + .../LogentriesLog4net.csproj | 27 ++++++++++----- .../LogentriesLog4net.nuspec | 21 ++++++++++++ .../Properties/AssemblyInfo.cs | 4 +-- src/LogentriesLog4net/packages.config | 1 + src/LogentriesNLog/LogentriesNLog.csproj | 27 ++++++++++----- src/LogentriesNLog/LogentriesNLog.nuspec | 21 ++++++++++++ src/LogentriesNLog/Properties/AssemblyInfo.cs | 4 +-- src/LogentriesNLog/packages.config | 1 + src/le_dotnet - Shortcut.lnk | Bin 1144 -> 0 bytes 15 files changed, 150 insertions(+), 49 deletions(-) create mode 100644 src/LogentriesCore/LogentriesCore.nuspec create mode 100644 src/LogentriesLog4net/LogentriesLog4net.nuspec create mode 100644 src/LogentriesNLog/LogentriesNLog.nuspec delete mode 100644 src/le_dotnet - Shortcut.lnk diff --git a/.gitignore b/.gitignore index 44dd6b8..5fc55c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.vs/ + + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. @@ -125,7 +128,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj @@ -181,3 +184,4 @@ UpgradeLog*.htm # Microsoft Fakes FakesAssemblies/ + diff --git a/src/LogentriesCore/LeClient.cs b/src/LogentriesCore/LeClient.cs index 11c330f..86f1ffd 100644 --- a/src/LogentriesCore/LeClient.cs +++ b/src/LogentriesCore/LeClient.cs @@ -1,37 +1,34 @@ using System; using System.IO; -using System.Linq; using System.Net.Security; using System.Net.Sockets; using System.Runtime.InteropServices; -using System.Security.Cryptography.X509Certificates; -using System.Text; namespace LogentriesCore.Net { class LeClient { - // Logentries API server address. - protected const String LeApiUrl = "api.logentries.com"; + // Logentries API server address. + protected const String LeIngestionHost = "data.logentries.com"; - // Port number for token logging on Logentries API server. + // Port number for token logging on Logentries API server. protected const int LeApiTokenPort = 10000; - // Port number for TLS encrypted token logging on Logentries API server + // Port number for TLS encrypted token logging on Logentries API server protected const int LeApiTokenTlsPort = 20000; - // Port number for HTTP PUT logging on Logentries API server. + // Port number for HTTP PUT logging on Logentries API server. protected const int LeApiHttpPort = 80; - // Port number for SSL HTTP PUT logging on Logentries API server. + // Port number for SSL HTTP PUT logging on Logentries API server. protected const int LeApiHttpsPort = 443; // Creates LeClient instance. If do not define useServerUrl and/or useOverrideProt during call - // LeClient will be configured to work with api.logentries.com server; otherwise - with + // LeClient will be configured to work with data.logentries.com server; otherwise - with // defined server on defined port. public LeClient(bool useHttpPut, bool useSsl, bool useDataHub, String serverAddr, int port) { - + // Override port number and server address to send logs to DataHub instance. if (useDataHub) { @@ -47,7 +44,7 @@ public LeClient(bool useHttpPut, bool useSsl, bool useDataHub, String serverAddr m_TcpPort = useHttpPut ? LeApiHttpPort : LeApiTokenPort; else m_TcpPort = useHttpPut ? LeApiHttpsPort : LeApiTokenTlsPort; - } + } } private bool m_UseSsl = false; @@ -55,7 +52,7 @@ public LeClient(bool useHttpPut, bool useSsl, bool useDataHub, String serverAddr private TcpClient m_Client = null; private Stream m_Stream = null; private SslStream m_SslStream = null; - private String m_ServerAddr = LeApiUrl; // By default m_ServerAddr points to api.logentries.com if useDataHub is not set to true. + private String m_ServerAddr = LeIngestionHost; // By default m_ServerAddr points to data.logentries.com if useDataHub is not set to true. private Stream ActiveStream { @@ -82,7 +79,7 @@ public void SetSocketKeepAliveValues(TcpClient tcpc, int KeepAliveTime, int Keep // .net 1.1 type //int SIO_KEEPALIVE_VALS = -1744830460; //(or 0x98000004) - //socket.IOControl(SIO_KEEPALIVE_VALS, inOptionValues, null); + //socket.IOControl(SIO_KEEPALIVE_VALS, inOptionValues, null); // .net 3.5 type tcpc.Client.IOControl(IOControlCode.KeepAliveValues, inOptionValues, null); @@ -95,15 +92,15 @@ public void Connect() // on Azure sockets will be closed after some minutes idle. // which for some reason messes up this library causing it to lose data. - + // turn on keepalive, to keep the sockets open. // I don't really understand why this helps the problem, since the socket already has NoDelay set // so data should be sent immediately. And indeed it does appear to be sent promptly when it works. m_Client.Client.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); - // set timeouts to 10 seconds idle before keepalive, 1 second between repeats, + // set timeouts to 10 seconds idle before keepalive, 1 second between repeats, SetSocketKeepAliveValues(m_Client, 10 *1000, 1000); - + m_Stream = m_Client.GetStream(); if (m_UseSsl) @@ -139,3 +136,4 @@ public void Close() } } } + diff --git a/src/LogentriesCore/LogentriesCore.csproj b/src/LogentriesCore/LogentriesCore.csproj index 5b3992f..f5c27ba 100644 --- a/src/LogentriesCore/LogentriesCore.csproj +++ b/src/LogentriesCore/LogentriesCore.csproj @@ -1,5 +1,6 @@  + Debug AnyCPU @@ -12,6 +13,20 @@ LogentriesCore v4.0 512 + logentries.core + 2.8.3 + Logentries + Copyright © 2020 + en + https://github.com/rapid7/le_dotnet/blob/master/LICENSE.txt + Logentries + https://github.com/rapid7/le_dotnet/ + Switch ingestion endpoint from legacy deprecated one. + Logentries logging core library for dotnet support. + logentries;logging;dotnet; + LogentriesCore + Logentries logging core library for dotnet support. + true true @@ -53,17 +68,13 @@ - - if $(ConfigurationName) == Release ( -COPY "$(TargetPath)" "%25NUGET_PROJECTS%25$(ProjectName)\2.6.0\lib\net40\" /Y -nuget pack %25NUGET_PROJECTS%25$(ProjectName)\2.6.0\logentries.core.nuspec /o %25NUGET_PROJECTS%25$(ProjectName)\2.6.0\ -) - - - \ No newline at end of file + + + diff --git a/src/LogentriesCore/LogentriesCore.nuspec b/src/LogentriesCore/LogentriesCore.nuspec new file mode 100644 index 0000000..51e1505 --- /dev/null +++ b/src/LogentriesCore/LogentriesCore.nuspec @@ -0,0 +1,21 @@ + + + + logentries.core + 2.8.3 + logentries.core + Logentries + Logentries + false + MIT + https://github.com/rapid7/le_dotnet/ + Logentries logging library core + Switch ingestion endpoint from legacy deprecated one. + Copyright © 2020 + logentries logging dotnet core + + + + + + diff --git a/src/LogentriesCore/Properties/AssemblyInfo.cs b/src/LogentriesCore/Properties/AssemblyInfo.cs index ccb6695..72e8587 100644 --- a/src/LogentriesCore/Properties/AssemblyInfo.cs +++ b/src/LogentriesCore/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("LogentriesCore")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Logentries logging core library for dotnet support.")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Logentries")] [assembly: AssemblyProduct("LogentriesCore")] -[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/src/LogentriesCore/packages.config b/src/LogentriesCore/packages.config index 4ad4dd2..08a9bbf 100644 --- a/src/LogentriesCore/packages.config +++ b/src/LogentriesCore/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/LogentriesLog4net/LogentriesLog4net.csproj b/src/LogentriesLog4net/LogentriesLog4net.csproj index 39d5b99..8203cf0 100644 --- a/src/LogentriesLog4net/LogentriesLog4net.csproj +++ b/src/LogentriesLog4net/LogentriesLog4net.csproj @@ -1,5 +1,6 @@  + Debug AnyCPU @@ -12,6 +13,20 @@ LogentriesLog4net v4.0 512 + true + logentries.log4net + 2.8.3 + Logentries + Copyright © 2020 + en + https://github.com/rapid7/le_dotnet/blob/master/LICENSE.txt + Logentries + https://github.com/rapid7/le_dotnet/ + Switch ingestion endpoint from legacy deprecated one. + Logentries logging library for log4net support. + logentries;logging;dotnet;log4net; + LogentriesLog4net + Logentries logging library for log4net support. true @@ -57,17 +72,13 @@ - - if $(ConfigurationName) == Release ( -COPY "$(TargetPath)" "%25NUGET_PROJECTS%25$(ProjectName)\2.5.0\lib\net40\" /Y -nuget pack %25NUGET_PROJECTS%25$(ProjectName)\2.5.0\logentries.log4net.nuspec /o %25NUGET_PROJECTS%25$(ProjectName)\2.5.0\ -) - - - \ No newline at end of file + + + diff --git a/src/LogentriesLog4net/LogentriesLog4net.nuspec b/src/LogentriesLog4net/LogentriesLog4net.nuspec new file mode 100644 index 0000000..9d85185 --- /dev/null +++ b/src/LogentriesLog4net/LogentriesLog4net.nuspec @@ -0,0 +1,21 @@ + + + + logentries.log4net + 2.8.3 + logentries.log4net + Logentries + Logentries + false + MIT + https://github.com/rapid7/le_dotnet/ + Logentries logging library for log4net support. + Switch ingestion endpoint from legacy deprecated one. + Copyright © 2020 + logentries logging dotnet log4net + + + + + + diff --git a/src/LogentriesLog4net/Properties/AssemblyInfo.cs b/src/LogentriesLog4net/Properties/AssemblyInfo.cs index 8bbda20..2dd51a6 100644 --- a/src/LogentriesLog4net/Properties/AssemblyInfo.cs +++ b/src/LogentriesLog4net/Properties/AssemblyInfo.cs @@ -6,9 +6,9 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("LogentriesLog4net")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Logentries logging library for log4net support")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Logentries")] [assembly: AssemblyProduct("LogentriesLog4net")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] diff --git a/src/LogentriesLog4net/packages.config b/src/LogentriesLog4net/packages.config index e25c2bd..8c2fce3 100644 --- a/src/LogentriesLog4net/packages.config +++ b/src/LogentriesLog4net/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/LogentriesNLog/LogentriesNLog.csproj b/src/LogentriesNLog/LogentriesNLog.csproj index 0804f7a..7d19803 100644 --- a/src/LogentriesNLog/LogentriesNLog.csproj +++ b/src/LogentriesNLog/LogentriesNLog.csproj @@ -1,5 +1,6 @@  + Debug AnyCPU @@ -12,6 +13,20 @@ LogentriesNLog v4.0 512 + true + logentries.nlog + 2.8.3 + Logentries + Copyright © 2020 + en + https://github.com/rapid7/le_dotnet/blob/master/LICENSE.txt + Logentries + https://github.com/rapid7/le_dotnet/ + Switch ingestion endpoint from legacy deprecated one. + Logentries logging library for NLog support. + logentries;logging;dotnet;nlog; + LogentriesNLog + Logentries logging library for NLog support. true @@ -57,17 +72,13 @@ - - if $(ConfigurationName) == Release ( -COPY "$(TargetPath)" "%25NUGET_PROJECTS%25$(ProjectName)\2.3.0\lib\net40\" /Y -nuget pack %25NUGET_PROJECTS%25$(ProjectName)\2.3.0\logentries.nlog.nuspec /o %25NUGET_PROJECTS%25$(ProjectName)\2.3.0\ -) - - - \ No newline at end of file + + + diff --git a/src/LogentriesNLog/LogentriesNLog.nuspec b/src/LogentriesNLog/LogentriesNLog.nuspec new file mode 100644 index 0000000..d51cdf4 --- /dev/null +++ b/src/LogentriesNLog/LogentriesNLog.nuspec @@ -0,0 +1,21 @@ + + + + logentries.nlog + 2.8.3 + logentries.nlog + Logentries + Logentries + false + MIT + https://github.com/rapid7/le_dotnet/ + Logentries logging library support for NLog + Switch ingestion endpoint from legacy deprecated one. + Copyright © 2020 + logentries logging dotnet nlog + + + + + + diff --git a/src/LogentriesNLog/Properties/AssemblyInfo.cs b/src/LogentriesNLog/Properties/AssemblyInfo.cs index 2b3060e..687a2e9 100644 --- a/src/LogentriesNLog/Properties/AssemblyInfo.cs +++ b/src/LogentriesNLog/Properties/AssemblyInfo.cs @@ -6,9 +6,9 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("LogentriesNLog")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Logentries logging library for NLog support")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Logentries")] [assembly: AssemblyProduct("LogentriesNLog")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] diff --git a/src/LogentriesNLog/packages.config b/src/LogentriesNLog/packages.config index dd3ea70..bc5b0cd 100644 --- a/src/LogentriesNLog/packages.config +++ b/src/LogentriesNLog/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/le_dotnet - Shortcut.lnk b/src/le_dotnet - Shortcut.lnk deleted file mode 100644 index 6cf08717cdab39934e872bb9be130e9bb98a32af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1144 zcmbVLZAepL6h3YyT2WJ{NQ_(`mQl02P1A(J*xiS?HsQ`xxZucLaWOaB?yz6ck0kn{ zAKI5tNFNqjM4$wHnE(2dF^a;3K%!qsi1bG&spssjVITy(m*>3a>pkbZ=RMa;L^(zs zDA81!lIuL>lL7qj_rs}Gvt*?5<~e`L{Ix!8xHXecy9MEf zk*ZFaeofy$;hA(yEH4$9OuQ@uYymP zk88`z=Fpg+5Fs~(NhJ>@2}h}v*+SQAHmU&B%JwP0B~ zI{kwpq)-QiD2CWk@G7ijzyM$Z^qIX5y9o4VWY+7h_KV!NK%?C%*y`+paEKiBa!W#q zCuHdNun%Aaw520imIBUZkJD#qZS;x$R!MUwNmY8gm8dMnI+Hz0R87cQm*j}j5sIl% zMMbD8e4KC%-U^^ffQwuQIW_cd`O>yWu7~51evdx~wVpS}q0eOpPP!M6$bzS|Pz_*9b5>A02dR08KURgMSSq_7(798Zv7TI~OA?Ry#RI*`EB9E2b%JKEK7x<-^>nN6VK59yn_7KTgt26i*xV_0+{FFHWsiF+ALc7!qHHy rFF~_b+t^^qZP%4$-