고용량의 텍스트 파일(25기가가 넘는 로그파일)을 보려니 일전에 올렸던 LTF 역시 답답해서 파일 분할, 검색 하기로 했다.

사실 결국 컴퓨터 사양이 좋으면, 로그를 꼭 필요한 것만 출력해서 용량차지가 적도록, 혹은 애초에 로그를 분석할 필요가 없는 코드를 짰다면 이런 일이 발생하지 않는데 아무튼 상황을 이지경으로 만든 사람은 누군지도 이 자리에 있지도 않으니 이런 잡 기술만 늘어가는 중이다.

PowerShell은 Linux 명령어랑은 많이 다르고 뭔가 맘에 안듦...

형식

$i=0; Get-Content 원본파일경로 + 파일명 -ReadCount 분할할_라인_수 | %{ $i++; $_ | Out-File 출력경로_파일명-$i.log; Write-Host $i }

 

$i=0; Get-Content .\WAS-29-20220325.log -ReadCount 1000 | %{ $i++; $_ | Out-File D:\cat_log\WAS-29\20220325-$i.log; Write-Host $i }
728x90
반응형

리눅스나 MacOS 는 tail 함수가 내장 되어 있기 때문에 서버의 로그를 실시간으로 보는 법은 간단하다.

Window의 경우는 cmd 상에서 명령어가 있긴 하지만, 버젼에 따라 없거나, 옵션 값도 달라지고 cli의 ux가 좋지 않기 때문에 차라리 써드파티 어플리케이션을 사용하는 게 낫다.

mtail 이라는 프로그램인데, 설치는 필요 없고, 아래 링크에서 다운로드 후 압축을 풀고 실행, 대상 파일을 불러와 주기만 하면 된다.

 

프로그램 다운로드 -> http://ophilipp.free.fr/op_tail.htm

728x90
반응형

# HTML에 GitHub Contribution Calendar 삽입하는 방법.

<!-- Prepare a container for your calendar. -->
<script src="https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.min.js"></script>

<!-- Optionally, include the theme (if you don't want to struggle to write the CSS) -->
<link rel="stylesheet" href="https://cdn.rawgit.com/IonicaBizau/github-calendar/gh-pages/dist/github-calendar.css"/>

<!-- Prepare a container for your calendar. -->
<div class="calendar">
    <!-- Loading stuff -->
    Loading the data just for you.
</div>

<script>
    new GitHubCalendar(".calendar", "your-username");
</script>

이 소스코드에서 `"your-usernamne"`부분에 github 이름을 넣어준다.

결과는 내 블로그 하단에...

728x90
반응형

+ Recent posts