Commit graph

537 commits

Author SHA1 Message Date
David Calavera
f1412f2942 Remove doc that doesn't apply to Journald.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-08-09 22:12:42 -05:00
Lei Jitang
5220f3b535 Enable golint in pkg/jsonlog and pkg/jsonmessage.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-08-08 11:28:22 +08:00
Qiang Huang
f5557f4f43 Remove unused variable
Introduced by #15209 unintentionally.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-08-03 09:14:52 +08:00
Brian Goff
c57faa91e2 Ensure reader position is at the end after tailing
After tailing a file, if the number of lines requested is > the number
of lines in the file, this would cause a json unmarshalling error to
occur when we later try to go follow the file.
So brute force set it to the end if any tailing occurred.

There is potential that there could be some missing log messages if logs
are being written very quickly, however I was not able to make this
happen even with `while true; do echo hello; done`, so this is probably
acceptable.

While testing this I also found a panic in LogWatcher.Close can be
called twice due to a race. Fix channel close to only close when there
has been no signal to the channel.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-08-01 08:00:28 -04:00
Morgan Bauer
ccbe539e86
golint fixes for daemon/logger/*
- downcase and privatize exported variables that were unused
 - make accurate an error message
 - added package comments
 - remove unused var ReadLogsNotSupported
 - enable linter
 - some spelling corrections

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-07-29 13:09:39 -07:00
Ankush Agarwal
41d85c014d Doc fixes in logger, update NewCopier method
Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
2015-07-29 10:05:46 -07:00
Alexander Morozov
eb45602d2f Use math.MaxInt32 instead of math.MaxUint32
I think it was original intention, because even half of a comment was about
MaxInt32.

Fix #15038

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-27 13:11:16 -07:00
Alexander Morozov
d68c55bc72 Fix option validation for log-drivers without it
There is no option validation for "journald" log-driver, so it makes no
sense to fail in that case.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-24 09:00:53 -07:00
Brian Goff
c0391bf554 Split reader interface from logger interface
Implement new reader interface on jsonfile.
Moves jsonlog decoding from daemon to jsonfile logger.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-07-21 20:47:31 -04:00
wlan0
9b782d3af3 add support for maximum log size, and max number of log files
Signed-off-by: wlan0 <sidharthamn@gmail.com>
2015-07-02 06:26:06 -07:00
TAGOMORI Satoshi
361a582ba0 Add new logging driver: fluentd
Signed-off-by: TAGOMORI Satoshi <tagomoris@gmail.com>
2015-06-26 11:03:11 +09:00
Dennis Docter
609e7b0a55 Add --log-opt to specify facility for syslog driver
Signed-off-by: Dennis Docter <dennis@d23.nl>
2015-06-23 14:04:25 +02:00
Marius Sturm
96d06e106f add UDP GELF logging-driver
allows to send container logs to Graylog or Logstash.

Signed-off-by: Marius Sturm <marius@graylog.com>
2015-06-10 20:21:50 +02:00
Alexander Morozov
a81af2e26a Add syslog-tag option for syslog log-driver
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-06-02 12:43:00 -07:00
Alexander Morozov
c42810fe99 Merge pull request #13564 from burke/fix-memory-leak
Use bufio.Reader instead of bufio.Scanner for logger.Copier
2015-05-29 13:37:15 -07:00
Burke Libbey
f779cfc5d8
Use bufio.Reader instead of bufio.Scanner for logger.Copier
When using a scanner, log lines over 64K will crash the Copier with
bufio.ErrTooLong. Subsequently, the ioutils.bufReader will grow without
bound as the logs are no longer being flushed to disk.

Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
2015-05-29 12:29:42 -04:00
Antonio Murdaca
e8c88d2533 Add syslog-address log-opt
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-29 00:42:11 +02:00
Ahmet Alp Balkan
8b11592d69 Pass -log-opts map to logdrivers
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-05-18 16:50:14 +00:00
John Howard
655a58e27b Windows: Factor out syslog and journald
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-14 10:34:09 -07:00
Ahmet Alp Balkan
3a8728b431 daemon: Logging drivers refactoring
- noplog driver pkg for '--log-driver=none' (null object pattern)
- centralized factory for log drivers (instead of case/switch)
- logging drivers registers themselves to factory upon import
  (easy plug/unplug of drivers in daemon/logdrivers.go)
- daemon now doesn't start with an invalid log driver
- Name() method of loggers is actually now their cli names (made it useful)
- generalized Read() logic, made it unsupported except json-file (preserves
  existing behavior)

Spotted some duplication code around processing of legacy json-file
format, didn't touch that and refactored in both places.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-05-12 19:11:52 +00:00
Lars Kellogg-Stedman
869ecba652 journald log driver: use CONTAINER_ID field for container id
This patch modifies the journald log driver to store the container ID in
a field named CONTAINER_ID, rather than (ab)using the MESSAGE_ID field.
Additionally, this adds the CONTAINER_ID_FULL field containing the
complete container ID and CONTAINER_NAME, containing the container name.

When using the journald log driver, this permits you to see log messages
from a particular container like this:

    # journalctl CONTAINER_ID=a9238443e193

Example output from "journalctl -o verbose" includes the following:

    CONTAINER_ID=27aae7361e67
    CONTAINER_ID_FULL=27aae7361e67e2b4d3864280acd2b80e78daf8ec73786d8b68f3afeeaabbd4c4
    CONTAINER_NAME=web

Closes: #12864
Signed-off-by: Lars Kellogg-Stedman <lars@redhat.com>
2015-04-30 10:42:27 -04:00
Dan Walsh
364287b741 Add journald as a supported logger for containers
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-04-21 12:57:54 -04:00
Darren Shepherd
05641ccffc Change syslog format and facility
This patch changes two things

1. Set facility to LOG_DAEMON
2. Remove ": " from tag so that the tag + pid become a single column in
   the log

Signed-off-by: Darren Shepherd <darren@rancher.com>
2015-04-15 12:46:43 -07:00
Deng Guangxing
4f91a333d5 move syslog-tag to syslog.New function
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-04-13 11:24:18 -07:00
unclejack
132da3f036 daemon/logger/jsonfilelog: avoid some allocations
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-04-02 18:33:23 +03:00
Alena Prokharchyk
dabd8a02ae Removed unused "mutex" field
fixes #11659

Signed-off-by: Alena Prokharchyk <alena@rancher.com>
2015-03-23 19:05:21 -07:00
Anton Tiurin
f2c7b4d743 Syslog.Log - Remove redundant cast of msg.Line []byte to string as
it's a fmt.Sprintf responsibility.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-03-24 01:35:54 +03:00
Alexander Morozov
2717302cc6 Merge pull request #11654 from runcom/11650-syslog-close-redunant-nil-check
syslog Close() - Remove redunant nil check, s.writer cannot be nil
2015-03-23 12:32:26 -07:00
Antonio Murdaca
e600df2d97 Remove redunant nil check, s.writer cannot be nil
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-23 20:03:24 +01:00
Antonio Murdaca
8f025aae36 Refactor syslog Log else clause
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-23 20:01:01 +01:00
Alexander Morozov
65e21f5703 Merge pull request #11458 from ibuildthecloud/syslog
Add syslog logging driver
2015-03-23 11:34:33 -07:00
sidharthamani
eaecd8b1b5 add syslog driver
Signed-off-by: wlan0 <sid@rancher.com>
2015-03-21 18:01:18 -07:00
Jessie Frazelle
474f58e2e7 Merge pull request #11471 from LK4D4/wait_for_copier
Wait for copier finishing it's work before closing logger
2015-03-18 15:41:12 -07:00
Alexander Morozov
b6a42673ab Wait for copier finishing it's work before closing logger
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-18 13:48:01 -07:00
Alexander Morozov
bd8661e8fa Protect jsonfilelog writes with mutex
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-18 13:00:53 -07:00
Alexander Morozov
47a6afb93f Default 'json-file' logging driver and none logging driver
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-13 12:13:21 -07:00
Alexander Morozov
14887e2e1f Interface Logger for logging drivers
Also there is aux datastructure Copier which can copy lines from streams
to Loggers

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-13 11:46:59 -07:00