Commit Graph

72 Commits

Author SHA1 Message Date
Adam C. Emerson
750ad8340c common: Unskew clock
In preparation to deglobalizing CephContext, remove the CephContext*
parameter to ceph_clock_now() and ceph::real_clock::now() that carries
a configurable offset.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2016-12-22 13:55:37 -05:00
Kefu Chai
d932c8f2f2 global/signal_handler: reset injected segv after test
~CephContext() => ~TypedSingletonWrapper() => ~MempoolObs =>
unregister_command() => ldout() << "unregister_command" =>
Log::submit_entry() => *(volatile int *)(0) = 0xdead;

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-11-22 22:29:45 +08:00
Sage Weil
9b1b510826 Merge pull request #9768 from cxwshawn/wip-tc1-fix
log: optimize header file dependency

Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-11-04 13:01:08 -05:00
Willem Jan Withagen
05f4be44dc Log: Replace namespace log with loging
- This to avoid a nameing confilct that Clang finds with
   std::log from cmath

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
2016-10-25 19:45:24 +02:00
Sage Weil
fba798dcad remove autotools
Signed-off-by: Sage Weil <sage@redhat.com>
2016-09-07 11:50:14 -04:00
shawn
0b2c90003d log: optimize header file dependency
Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
2016-06-16 22:03:15 -04:00
Brad Hubbard
3ab5a660a4 log: Log.cc: Assign LOG_INFO priority to syslog calls
LOG_DEBUG prio messages are not logged by a default syslog
configuration so log at LOG_INFO instead.

Fixes: #15808
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
2016-05-10 16:44:44 +10:00
Sage Weil
2c6b95eb70 Merge pull request #8811 from stiopaa1/log_includes
log: remove unnecessary includes from header file

Reviewed-by: Sage Weil <sage@redhat.com>
2016-05-04 09:12:47 -04:00
Michal Jarzabek
37fdc2e649 log: remove unnecessary includes from header file
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
2016-04-28 13:27:46 +01:00
Kefu Chai
031a27a90a log: remove unnecessary src/log/Graylog.*
we have two copies of Graylog.* in src/common and src/log, and turns out
the ones in src/common are what we are using. so remove the other two.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-04-21 18:05:26 +08:00
Sage Weil
9ed77c82d2 log: do not pass negative fd to fchown
>>>     CID 1355574:  Error handling issues  (NEGATIVE_RETURNS)
>>>     "this->m_fd" is passed to a parameter that cannot be negative.

Signed-off-by: Sage Weil <sage@redhat.com>
2016-03-14 12:50:33 -04:00
Sage Weil
d9ac0474b8 log: do not repeat errors to stderr
If we get an error writing to the log, log it only once to stderr.
This avoids generating, say, 72 GB of ENOSPC errors in
teuthology.log when /var/log fills up.

Fixes: #14616
Signed-off-by: Sage Weil <sage@redhat.com>
2016-03-10 09:50:07 -05:00
Sage Weil
bdd2ddb387 Merge pull request #7904 from liewegas/wip-log-delete
log: use delete[]

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Nathan Cutler <ncutler@suse.com>
2016-03-08 11:20:10 -05:00
Sage Weil
37f14a5d94 Merge branch 'wip-conf-root' of https://github.com/liewegas/ceph
Reviewed-by: Josh Durgin <jdurgin@redhat.com>

Conflicts:
	src/common/config.cc
2016-03-07 15:36:13 -05:00
Sage Weil
58250f59c6 log: fix some whitespace
Signed-off-by: Sage Weil <sage@redhat.com>
2016-03-03 09:42:54 -05:00
Sage Weil
23f459ccd6 log: use correct delete[]
Signed-off-by: Sage Weil <sage@redhat.com>
2016-03-03 09:42:54 -05:00
Kefu Chai
c05300b182 log: segv in a portable way
this piece of code creates a SEGV from logging code to verify a
bug fix at e3fe18a.

clang will delete the null-referencing code. so we need to either
- pass -Wnonull-dereference to $(CC)
- or use  __builtin_trap() offered by GCC/clang
- or use `volatile`
seems volatile is easier and probably more portable.

Fixes: #14856
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-02-26 15:19:45 +08:00
Sage Weil
ccfbca425a Merge pull request #7599 from ifed01/wip-14707
log: fix stack overflow when flushing large log lines

Reviewed-by: Sage Weil <sage@redhat.com>
2016-02-24 10:42:04 -08:00
Danny Al-Gaaf
a37ae6a3e3 log/Graylog.h: make ctor explicit
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2016-02-19 12:51:11 +01:00
Igor Fedotov
d8675cf49b Log: Adding UT to catch an issue with huge line logging
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
2016-02-11 20:45:38 +03:00
Igor Fedotov
dd533a9e01 Log: Fixing stack overflow when flushing large log lines.
See http://tracker.ceph.com/issues/14707

Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
2016-02-11 20:19:32 +03:00
Sage Weil
32da9626a5 log: add option fchown on log file
Add explicit call to set the log file uid/gid.  fchown it
immediately, and do the same if it is reopened.

Signed-off-by: Sage Weil <sage@redhat.com>
2016-02-10 13:17:27 -05:00
Kefu Chai
f5cad7ac4e log: remove "boost/asio.hpp" from Log.h
graylog uses boost/asio.hpp which introduces the link-time dependency on
libboost_system to the compilation units which includes Log.h and
LogClient.h. so it appears that perfglue/heap_profiler.cc is referencing
libboost_system.so, and fails the cmake build of all tests which links
against tcmalloc.

in this change, we:

* remove unnecessary #includes from Graylog.h
* forward declare Graylog class, so that "Graylog.h" is not included in
  any header files to avoid the link-time dependency pollution

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-02-09 21:27:25 -08:00
Sage Weil
9a80477432 Merge branch 'gelf-logging-backend' of git://github.com/irq0/ceph
Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-02-03 08:48:26 -05:00
Danny Al-Gaaf
bbf0582342 make ctors with one argument explicit
Use explicit keyword for constructors with one argument to
prevent implicit usage as conversion functions.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2016-01-29 23:48:58 +01:00
Marcel Lauhoff
c4892d941b Graylog: Integrate with Log{Client,LogMonitor}
Adds graylog/GELF logging support to clog and monitor log.

Changes to Graylog class:
- Support Logging LogEntry classes
- Add parameter "logger" to indicate the log source
  (e.g dlog, clog, mon)

New config opts:
- clog to graylog
- clog to graylog host
- clog to graylog port

- mon cluster log to graylog
- mon cluster log to graylog host
- mon cluster log to graylog port

Signed-off-by: Marcel Lauhoff <ml@irq0.org>
2016-01-29 15:33:36 +01:00
Marcel Lauhoff
f88fcf032f debian: Add build dep 'libboost-iostreams-dev'
Required by graylog logging backend

Signed-off-by: Marcel Lauhoff <ml@irq0.org>
2016-01-29 15:32:47 +01:00
Marcel Lauhoff
92bb54243e graylog: Move graylog logging to Ceph::Log::Graylog class
Encapsulates all resources the graylog logging backend needs into the
Graylog class.

Signed-off-by: Marcel Lauhoff <ml@irq0.org>
2016-01-29 15:32:47 +01:00
Marcel Lauhoff
a483168a2f Graylog2 logging
Add graylog2 as logger target. Format log entries as GELF and send them via UDP to log server

New config options
 -  log_to_graylog
 -  err_to_graylog
 -  log_graylog_host
 -  log_graylog_port

[0] https://www.graylog2.org/resources/gelf

Signed-off-by: Marcel Lauhoff <ml@irq0.org>
2016-01-29 15:32:47 +01:00
Jason Dillaman
a290d34ebd Merge remote-tracking branch 'upstream/jewel' 2016-01-14 16:21:05 -05:00
Jason Dillaman
8f8b4e2947 helgrind: annotate false-positive race conditions
Fixes: #14163
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2016-01-13 09:54:29 -05:00
Igor Podoski
4a4b447e35 threads: add thread names
Adding names to threads simplifies cpu usage realtime tracking
e.g. top -H -p <OSD_PID>

This commit changes Thread.create() method forcing to pass thread name.

Signed-off-by: Igor Podoski <igor.podoski@ts.fujitsu.com>
2016-01-05 15:15:36 +01:00
Brad Hubbard
8e93f3f45d log: Log.cc: Assign LOG_DEBUG priority to syslog calls
Fixes: #13993
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
2015-12-18 08:52:58 +10:00
Adam Kupczyk
999b24f722 Implemented log message size predictor. It tracks size of log messages.
Initial allocation size is derived from last log message from the same line of code.
Fixed bug in test.

Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
2015-12-01 18:15:48 +01:00
Adam Kupczyk
5bfe05aebf Speed optimizations. Merged 3 writes into 1.
Got rid of std::string construction.
More unification on syslog,stderr,fd.

Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
2015-11-17 10:32:19 +01:00
Sage Weil
631469c40b Revert "Speed optimizations. Merged 3 writes into 1."
This reverts commit 91497e4633.

Oops, this is injecting \0 in the log output.

Signed-off-by: Sage Weil <sage@redhat.com>
2015-10-25 11:50:20 -04:00
Adam Kupczyk
91497e4633 Speed optimizations. Merged 3 writes into 1.
Got rid of std::string construction.
More unification on syslog,stderr,fd.

Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
2015-10-19 14:05:20 +02:00
Samuel Just
8778ab3a1c Log::reopen_log_file: take m_flush_mutex
Otherwise, _flush() might continue to write to m_fd after it's closed.
This might cause log data to go to a data object if the filestore then
reuses the fd during that time.

Fixes: #12465
Backport: firefly, hammer
Signed-off-by: Samuel Just <sjust@redhat.com>
2015-07-24 15:38:20 -07:00
Jason Dillaman
c1e1445177 log: fix helgrind warnings regarding possible data race
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
2015-06-04 16:49:51 -04:00
Sage Weil
a8c943a0e4 log: add simple test to verify an internal SEGV doesn't hang
Test that the segv injection works.

Test that a segv while logging something doesn't hang when the signal
handlers are installed.  Note that this fails/hangs without the previous
fix.

Signed-off-by: Sage Weil <sage@redhat.com>
2014-09-12 17:18:01 -07:00
Sage Weil
558463e815 log: add Log::is_inside_log_lock()
Signed-off-by: Sage Weil <sage@redhat.com>
2014-09-12 15:24:50 -07:00
Andrey Kuznetsov
59d18ac22d [RGW, memory leak] Memory leak in RGW has been fixed: deletion of allocated pointer to pointer to Log object has been added to "on_exit" handler.
Memory leaks detector report:

$ valgrind  --leak-check=full /usr/bin/radosgw -c /etc/ceph/ceph.conf -n
client.radosgw.gateway -
...
==16986== 8 bytes in 1 blocks are definitely lost in loss record 14 of 83
==16986==    at 0x4A075BC: operator new(unsigned long) (vg_replace_malloc.c:298)
==16986==    by 0x58980B8: ceph::log::Log::set_flush_on_exit() (in /usr/lib64/librados.so.2.0.0)
==16986==    by 0x6BE3CA: global_init(std::vector<char const*, std::allocator<char const*> >*, st
==16986==    by 0x5B6B0A: main (in /usr/bin/radosgw)
...

Signed-off-by: Andrey Kuznetsov <Andrey_Kuznetsov@epam.com>
2014-06-29 22:26:25 +04:00
Noah Watkins
0e376ee742 compat: avoid unused warn with TEMP_FAILURE_RETRY
The version of TEMP_FAILURE_RETRY found on Linux has a GNU extension
that squashes the unused return value warning where applicable. This
adds a VOID_TEMP_FAILURE_RETRY to make the case explicit, casting the
expression value to void to avoid the warning.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2014-02-23 11:17:42 -08:00
Noah Watkins
7aa980528c log: use on exit manager to flush logs on exit
on_exit is not portable, and atexit doesn't allow parameters to be
passed to callbacks.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2014-01-04 12:54:03 -08:00
Noah Watkins
e2be099118 compat: define replacement TEMP_FAILURE_RETRY
Not all platforms have it.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-12-07 10:18:51 -08:00
Roald J. van Loon
6949d221ad automake cleanup: implementing non-recursive make
- Enabling subdir objects
- Created a Makefile-env.am with basic automake init
- Created .am files per subdir, included from src/Makefile.am

Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
2013-09-08 00:11:09 +02:00
Noah Watkins
88f4a962e1 log: remove unused lock
m_lock is initialized and destroyed, but never used.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-07-22 19:54:37 -07:00
Danny Al-Gaaf
aad71dfd6b src/log/Entry.h: pass function parameter by reference
Fix "(performance) Function parameter 's' should be passed by reference."
from cppchecker.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-02-11 11:38:02 +01:00
Sage Weil
43cba617aa log: fix locking typo/stupid for dump_recent()
We weren't locking m_flush_mutex properly, which in turn was leading to
racing threads calling dump_recent() and garbling the crash dump output.

Backport: bobtail, argonaut
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
2013-01-02 17:01:32 -08:00
Sage Weil
813787af3d log: broadcast cond signals
We were using a single cond, and only signalling one waiter.  That means
that if the flusher and several logging threads are waiting, and we hit
a limit, we the logger could signal another logger instead of the flusher,
and we could deadlock.

Similarly, if the flusher empties the queue, it might signal only a single
logger, and that logger could re-signal the flusher, and the other logger
could wait forever.

Intead, break the single cond into two: one for loggers, and one for the
flusher.  Always signal the (one) flusher, and always broadcast to all
loggers.

Backport: bobtail, argonaut
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
2012-12-28 15:08:29 -08:00