AmazonLinuxのOSログをSumoLogicへ出力する

2017.10.12

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

まえがき

以前に手動でローカルのログファイルをSumoLogicへアップロードを行いました。
これだけではSumoLogicを生かせないので特に確認を行いたいと思われる/var/log/secureログをSumoLogicへアップロードする手順を纏めます。

SumoLogicのアクセスキーを作成する

ダッシュボードの[ユーザー名]-[Preferences]を選択します。

screenshot_2017-10-12_14_08_54

「My Access Keys」の右横にある+アイコンを選択します。 screenshot_2017-10-12_14_09_09

アクセスキーのラベルを入力して「Generate Key」を選択します。 screenshot_2017-10-12_14_10_47

アクセスIDとアクセスキーが発行されますので、メモを取得します。
※アクセスキーは後から確認が出来ない模様ですので、スクリーンショット又はメモを取る必要があります。 screenshot_2017-10-12_14_11_31

以下のようになればアクセスキー発行が完了です。 screenshot_2017-10-12_14_12_18

collectorパッケージをダウンロード

ダッシュボードから[manage]-[Collection]を選択します。
screenshot_2017-10-11_2_10_16

Select Collector Typeにて[Installed Collector]を選択します。 screenshot_2017-10-11_2_10_33

OS別コレクターパッケージが表示されるので今回はAmazonLinuxで試して見るので「Linux(64-bit)」を選択します。 screenshot_2017-10-11_2_10_50

インスタンス操作

ファイル転送後、ダウンロードしたシェルスクリプトに実行権限が付与されていないので実行権限を付与します。

$ ll SumoCollector_linux_amd64_19_209-5.sh
-rw-r--r-- 1 ec2-user ec2-user 79098877 10月 10 17:19 SumoCollector_linux_amd64_19_209-5.sh

$ chmod +x SumoCollector_linux_amd64_19_209-5.sh

$ ll SumoCollector_linux_amd64_19_209-5.sh
-rwxr-xr-x 1 ec2-user ec2-user 79098877 10月 10 17:19 SumoCollector_linux_amd64_19_209-5.sh
$ sudo ./SumoCollector_linux_amd64_19_209-5.sh
Unpacking JRE ...
Preparing JRE ...
Starting Installer ...
You are about to install the Sumo Logic Collector on this computer.
OK [o, Enter], Cancel 
o
Please read the following License Agreement. You must accept the terms of this agreement before continuing with the installation.

〜 規約分が表示されます 〜

★アグリーメントに同意するので「1」を入力してEnter
I accept the agreement
Yes [1], No [2]
1

★SumoLogicコレクターのインストール先を指定します。
今回はテストなので変更せずにEnter
Where should Sumo Logic Collector be installed?
[/opt/SumoCollector]

Extracting files...

★ホスト情報の確認が表示されます。
Please confirm the settings below
Collector name: ip-172-31-16-211
Collector URL: Default
Run as user: Default
Proxy: None
Collection Sources: None

★コレクターをインストールする際、認証のためにGUIで作成したSumoLogicアクセスID,アクセスキーを入力します。
Please specify what kind of credentials you will use to authenticate
Setup Wizard Token [1, Enter], Access Key [2]
2
Select this option if you have a Sumo Logic Access Id and Key
Access Id / Key
Please enter your Sumo Logic Account accesss id and key
Access Id:
[]
xxxxxxxxxxxxxx
Access Key:

Initializing Collector
Setup has finished installing Sumo Logic Collector on your computer.
Finishing installation...

以上でホストへのインストールが完了しました。

先程のManage Collectionを見てみると、今回コレクターをインストールしたインスタンスが追加されておりました。
screenshot_2017-10-12_2_11_41

送信ソースファイルの指定を行います。 対象のインスタンスの[Add]-[Add Source]を選択します。 screenshot_2017-10-12_2_16_23

ソースファイルの選択を行います。
今回は対象インスタンス内のファイルを参照するので「Local File」を選択します。 screenshot_2017-10-12_2_17_38

赤枠で囲っている必要設定項目を埋めて、「Save」を選択します。 managecollection

secure_logの項目が増えました。 screenshot_2017-10-12_12_04_21

ダッシュボードからログを確認してみます。 screenshot_2017-10-12_12_06_22

ログが取り込まれました!

最後に

Collectorを入れることでログ取り込みを行うことに成功しました。
これからはログ周りの検索などを纏めていきたいと思います!