Date: Thu, 28 Mar 2024 09:30:02 +0000 (UTC) Message-ID: <2052190164.713.1711618202386@ip-10-30-146-46.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_712_649353421.1711618202383" ------=_Part_712_649353421.1711618202383 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Different users expressed the exigence to log (specially in prod= uction environments) to external syslog servers.
By deafult, ONOS uses the log4j library to provide its logging functiona= lity. Change its standard behavior is pretty easy: the user needs only to a= dd an additional appender (a syslog appender) to a specific configuration f= ile, which will overwrite the standard one provide with ONOS.
In this little howto it's assumed the following:
Please, follow the steps below:
Copy the default configuration file of log4j (provided with ONOS) in= side the proper config folder
$ cp ~/= onos/tools/package/etc/org.ops4j.pax.logging.cfg ~/onos/tools/package/confi= g/org.ops4j.pax.logging.cfg
Edit the configuration file with the editor you prefer and modify it= accordingly
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie= d. # See the License for the specific language governing permissions and # limitations under the License. # ###########################################################################= ##### # Root logger log4j.rootLogger=3DINFO, out, syslog, osgi:* log4j.throwableRenderer=3Dorg.apache.log4j.OsgiThrowableRenderer # CONSOLE appender not used by default log4j.appender.stdout=3Dorg.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=3D%d{ISO8601} | %-5.5p | %-1= 6.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} = | %m%n # Syslog appender log4j.appender.syslog=3Dorg.apache.log4j.net.SyslogAppender log4j.appender.syslog.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.syslog.layout.ConversionPattern=3D%d{ISO8601} | %-5.5p | %-1= 6.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} = | %m%n log4j.appender.syslog.syslogHost=3DIP-OF-SYSLOG-SERVER log4J.appender.syslog.facility=3DKARAF log4j.appender.syslog.facilityPrinting=3Dfalse # File appender log4j.appender.out=3Dorg.apache.log4j.RollingFileAppender log4j.appender.out.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=3D%d{ISO8601} | %-5.5p | %-16.1= 6t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %= m%n log4j.appender.out.file=3D${karaf.data}/log/karaf.log log4j.appender.out.append=3Dtrue log4j.appender.out.maxFileSize=3D1MB log4j.appender.out.maxBackupIndex=3D10 # Sift appender log4j.appender.sift=3Dorg.apache.log4j.sift.MDCSiftingAppender log4j.appender.sift.key=3Dbundle.name log4j.appender.sift.default=3Dkaraf log4j.appender.sift.appender=3Dorg.apache.log4j.FileAppender log4j.appender.sift.appender.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.sift.appender.layout.ConversionPattern=3D%d{ISO8601} | %-5.5= p | %-16.16t | %-32.32c{1} | %m%n log4j.appender.sift.appender.file=3D${karaf.data}/log/$\\{bundle.name\\}.lo= g log4j.appender.sift.appender.append=3Dtrue
Reconfigure the target ONOS nodes / deploy ONOS, as described in the= users guide on the wiki.