summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--phosphor-rsyslog-config/server-conf.cpp26
2 files changed, 27 insertions, 4 deletions
diff --git a/README.md b/README.md
index e0ea54a..f8ab729 100644
--- a/README.md
+++ b/README.md
@@ -62,10 +62,15 @@ curl -b cjar -k -H "Content-Type: application/json" -X PUT \
https://<BMC IP address>//xyz/openbmc_project/network/config/attr/HostName
```
+#### Disabling remote logging
+Remote logging can be disabled by writing 0 to the port, or an empty string("")
+to the IP.
+
#### Changing the rsyslog server
When switching to a new server from an existing one (i.e the address, or port,
or both change), it is recommended to disable the existing configuration first.
+
## Adding application specific error YAML
* This document captures steps for adding application specific error YAML files
and generating local elog-errors.hpp header file for application use.
diff --git a/phosphor-rsyslog-config/server-conf.cpp b/phosphor-rsyslog-config/server-conf.cpp
index 16c792d..1372e85 100644
--- a/phosphor-rsyslog-config/server-conf.cpp
+++ b/phosphor-rsyslog-config/server-conf.cpp
@@ -11,6 +11,12 @@ namespace utils = phosphor::rsyslog_utils;
std::string Server::address(std::string value)
{
+ auto serverAddress = address();
+ if (serverAddress == value)
+ {
+ return serverAddress;
+ }
+
writeConfig(value, port(), configFilePath.c_str());
auto result = NetworkClient::address(value);
return result;
@@ -18,6 +24,12 @@ std::string Server::address(std::string value)
uint16_t Server::port(uint16_t value)
{
+ auto serverPort = port();
+ if (serverPort == value)
+ {
+ return serverPort;
+ }
+
writeConfig(address(), value, configFilePath.c_str());
auto result = NetworkClient::port(value);
return result;
@@ -28,14 +40,20 @@ void Server::writeConfig(
uint16_t serverPort,
const char* filePath)
{
+ std::fstream stream(filePath, std::fstream::out);
+
if (serverPort && !serverAddress.empty())
{
- std::fstream stream(filePath, std::fstream::out);
- // write '*.* @@remote-host:port'
+ // write '*.* @@<remote-host>:<port>'
stream << "*.* @@" << serverAddress << ":" << serverPort;
-
- utils::restart();
}
+ else // this is a disable request
+ {
+ // write '#*.* @@remote-host:port'
+ stream << "#*.* @@remote-host:port";
+ }
+
+ utils::restart();
}
} // namespace rsyslog_config
OpenPOWER on IntegriCloud