LukeHan 의 잡다한 기술 블로그

Confluence Access Browser 확인 방법 본문

Software/Atlassian

Confluence Access Browser 확인 방법

LukeHan1128 2022. 11. 21. 20:00
반응형

이 문서는 Confluence 에서 Access 로그를 확인하여 접속 Browser 정보를 획득하는 방법입니다.

 

 

 

 

출력 코드

아래 코드를 확인 대상 서버의 Confluence 의 Access 로그가 있는 폴더에 추가한 후 실행합니다.

#!/bin/bash
 
echo "[$(date +%y%m%d_%H%M%S)] Start"
 
# config
export_log_file_for_customer="get_access_browser_list_$(date +%y%m%d_%H%M%S).log"
export_log_file="get_access_browser_list_$(date +%y%m%d_%H%M%S).log"
log_file="conf_access_log.2022-"
 
last_month=07
cnt=05  #Start month
 
# Filter
ie_filter='Windows NT.*WOW'
ie_old_filter='MSIE'
edge_filter='Edge'
wChrome_filter='Windows NT.*AppleWebKit'
lChrome_filter='X11; Linux.*AppleWebKit'
mChrome_filter='Macintosh.*Mac OS.*.*AppleWebKit'
aChrome_filter='Linux; Android.*AppleWebKit'
wFirefox_filter='Windows NT.*Firefox'
lFirefox_filter='X11;.*Linux.*rv:.*Firefox'
others='JIRA-|Bitbucket-|FishEye-|Proxy Confluence Server|Confluence|healthcheck|curl|CalDavSynchronizer|Apache-HttpClient|Atlassian-Gadgets-HttpClient|analysis-portal|python-requests|GoEdit|RealObjectsMartha|PostmanRuntime|Java|Microsoft-WebDAV-MiniRedir|Microsoft Office PowerPoint|Microsoft Office Excel|Microsoft Office Protocol Discovery|Microsoft Office Existence Discovery|Microsoft Office OneNote|Microsoft Office Word|Microsoft Office/16.0'
 
 
# make file
echo "Date,IE,Edge,Chrome,Etc,Total" > $export_log_file_for_customer
 
while [ $last_month -ge $cnt ]
do
  month=$(ls | grep "$log_file""$cnt""-")
 
  for day in $month
  do
    echo "$day"
 
    all=$(cat $day | wc -l)
 
    ie=$(cat $day | grep -E "$ie_filter" | grep -Ev "$ie_old_filter|$edge_filter|$others" | wc -l)
    ie_old=$(cat $day | grep -E "$ie_old_filter" | grep -Ev "$edge_filter|$others" | wc -l)
    edge=$(cat $day | grep -E "$edge_filter" | grep -Ev "$others" | wc -l)
    wChrome=$(cat $day | grep -E "$wChrome_filter" | grep -Ev "$edge_filter|$ie_filter|$ie_old_filter|$edge_filter|$others" | wc -l)
    lChrome=$(cat $day | grep -E "$lChrome_filter" | grep -Ev "$edge_filter|$ie_filter|$ie_old_filter|$edge_filter|$others" | wc -l)
    mChrome=$(cat $day | grep -E "$mChrome_filter" | grep -Ev "$edge_filter|$ie_filter|$ie_old_filter|$edge_filter|$others" | wc -l)
    aChrome=$(cat $day | grep -E "$aChrome_filter" | grep -Ev "$edge_filter|$ie_filter|$ie_old_filter|$edge_filter|$others" | wc -l)
    wFirefox=$(cat $day | grep -E "$wFirefox_filter" | grep -Ev "$ie_filter|$ie_old_filter|$edge_filter|$wChrome_filter|$others" | wc -l)
    lFirefox=$(cat $day | grep -E "$lFirefox_filter" | grep -Ev "$ie_filter|$ie_old_filter|$edge_filter|$others" | wc -l)
    other=$(cat $day | grep -E "$others" | wc -l)
 
    calc=$(($ie + $ie_old + $edge + $wChrome + $lChrome + $mChrome + $aChrome + $wFirefox + $lFirefox + $other))
#    echo "$ie + $ie_old + $edge + $wChrome + $lChrome + $mChrome + $aChrome + $wFirefox + $lFirefox + $other = $calc // $(($all - $calc))"
 
    # add data in log file
    echo "$(echo $day | awk -F '.' '{print $2}'),$(($ie + $ie_old)),$edge,$(($wChrome + $lChrome + $mChrome + $aChrome)),$(($wFirefox + $lFirefox + $other + ($all - $calc))),$all" >> $export_log_file_for_customer
 
  done
 
  ((cnt++))
 
  if [ $(echo $cnt | awk '{print length}') = 1 ]
  then
    cnt="0$cnt"
  fi
done
 
echo "[$(date +%y%m%d_%H%M%S)] End"
exit

 

 

 

엑셀 파일 생성

get_access_browser_list_년월_일시.log 형식으로 된 로그 파일을 열어 내용을 확인한 후 출력 내용을 복사합니다.

 

 

 

 

데이터를 추가할 엑셀 파일의 상단 "홈 > 붙여넣기 > 텍스트 마법사 사용" 을 클릭 실행합니다.

 

 

 

 

2단계에서 위와 같이 "쉼표" 를 체크한 후 "마침" 버튼을 클릭 실행합니다.

 

반응형
Comments