Skip to content

Commit c05e0a7

Browse files
author
Christopher M. Neill
committed
style fixes and comments
1 parent ce65446 commit c05e0a7

3 files changed

Lines changed: 40 additions & 18 deletions

File tree

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
# not really an alias
22
function logtail() {
3-
MY_APP="$1"
4-
MY_DATE=`date +%Y/%m/%d/%H`
5-
MY_LOGDIR="{{ app_log_dir }}"
6-
MY_LOGFILE="${MY_LOGDIR}/${MY_DATE}/${MY_APP}.log"
7-
tail -f ${MY_LOGFILE} | bunyan
3+
# Usage: logtail <app_name>
4+
# Name of the app log you wish you view, eg: api, navi, docker-listener, swarm-manager
5+
local app_name="$1"
6+
# string of the current year, month, day and hour in YYYY/MM/DD/HH format
7+
local datetime=`date +%Y/%m/%d/%H`
8+
# location of application logs specified in ansible configuration
9+
local app_log_dir="{{ app_log_dir }}"
10+
# concatenate this strings to derive the full log path
11+
local logfile="${app_log_dir}/${datetime}/${app_name}.log"
12+
# follow logfile, format via bunyan
13+
tail -f ${logfile} | bunyan
814
}
915

1016
function npmlog() {
11-
MY_APP="$1"
12-
MY_LOGDIR="/var/log"
13-
MY_LOGFILE="${MY_LOGDIR}/${MY_APP}.log"
14-
less ${MY_LOGFILE}
17+
# Usage: npmlog <app_name>
18+
# Name of the app npm log you wish to view.
19+
local app_name="$1"
20+
# system log dir
21+
local app_log_dir="/var/log"
22+
# npm log
23+
local logfile="${app_log_dir}/${app_name}.log"
24+
less ${logfile}
1525
}
1626

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
# not really an alias
22
function logtail() {
3-
MY_APP="$1"
4-
MY_DATE=`date +%Y/%m/%d/%H`
5-
MY_LOGDIR="{{ app_log_dir }}"
6-
MY_LOGFILE="${MY_LOGDIR}/${MY_DATE}/${MY_APP}.log"
7-
tail -f ${MY_LOGFILE} | bunyan
3+
# Usage: logtail <app_name>
4+
# Name of the app log you wish you view, eg: api, navi, docker-listener, swarm-manager
5+
local app_name="$1"
6+
# string of the current year, month, day and hour in YYYY/MM/DD/HH format
7+
local datetime=`date +%Y/%m/%d/%H`
8+
# location of application logs specified in ansible configuration
9+
local app_log_dir="{{ app_log_dir }}"
10+
# concatenate this strings to derive the full log path
11+
local logfile="${app_log_dir}/${datetime}/${app_name}.log"
12+
# follow logfile, format via bunyan
13+
tail -f ${logfile} | bunyan
814
}
915

1016
function npmlog() {
11-
MY_APP="$1"
12-
MY_LOGDIR="/var/log"
13-
MY_LOGFILE="${MY_LOGDIR}/${MY_APP}.log"
14-
less ${MY_LOGFILE}
17+
# Usage: npmlog <app_name>
18+
# Name of the app npm log you wish to view.
19+
local app_name="$1"
20+
# system log dir
21+
local app_log_dir="/var/log"
22+
# npm log
23+
local logfile="${app_log_dir}/${app_name}.log"
24+
less ${logfile}
1525
}
1626

ansible/roles/loggly/files/rsyslog.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ $KLogPermitNonKernelFacility on
3636
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
3737

3838
# Runnable JSON logging format
39+
# Creates an "output formatter" template that accepts as input JSON and prints it out without any further processing ("raw JSON").
40+
# The formatting around the %msg% string is as such: start printing at the second character "2" until the end of the line "$" using the raw JSON format type.
3941
$template RunnableJSON,"%msg:2:$:jsonr%\n"
4042

4143
# Filter duplicated messages

0 commit comments

Comments
 (0)