SLA

SLA is an abbreviation of Service Level Agreement, which is an agreement on the level of service (definition, scope, content, achievement goals, etc.) established between the provider of the service and its users. This is a statement to the extent that the service provider can guarantee the quality to the contractor.

SLAs are often used mainly for communication services, cloud services, rental servers, etc. We define service definition and guarantee items such as communication speed and upper limit of use stop time, and if the service quality falls below the guarantee value of SLA, reduction of charge will be performed.

ELB access log

ELBでアクセスログが取得できる。

2014-03-07T07:25:38.285777Z elber 130.0.237.XX:37522 172.31.4.218:80 0.000066 0.00105 0.000037 404 404 0 570 "GET http://54.249.27.XX:80/actus4/ HTTP/1.1"
2014-03-07T07:26:43.731149Z elber 77.50.22.XXX:53477 172.31.4.218:80 0.000053 0.000866 0.000053 200 200 0 10 "GET http://54.249.27.XX:80/ HTTP/1.0"
2014-03-07T07:26:44.410747Z elber 77.50.22.XXX:53656 172.31.4.218:80 0.000052 0.000853 0.000039 404 404 0 168 "GET http://54.249.27.XX:80/foltia/ HTTP/1.0"
2014-03-07T07:26:45.084730Z elber 77.50.22.XXX:53839 172.31.4.218:80 0.000061 0.000874 0.000035 404 404 0 168 "GET http://54.249.27.XX:80/epgrec/do-record.sh HTTP/1.0"
2014-03-07T07:28:12.386207Z elber 189.206.75.XX:64289 172.31.4.218:80 0.000062 0.000924 0.000035 404 404 0 168 "GET http://54.249.27.XX:80/manager/html HTTP/1.1"

問題は、項目。

timestamp
The time accessed by the Client. UTC time, recorded in ISO 8601 format.
2014-02-15T23: 39: 43. 945958 Z

Name of ELB
ELB Name: test-loadbalancer

Client
Port Client IP address and port number
192.168.131.39.2817

Backend
port IP address and port number of the instance to which communication was distributed by ELB. This will tell you which server it was assigned to 10.0.0.0:80

request_processing_time
The time between the ELB receiving a request from the client and sending the request to the instance
0.000073

backend_processing_time
The time it takes for the ELB to send a request to an instance and the instance returns a response.
0.001048

response_processing_time
The time from when the ELB receives a response from an instance to when it returns a response to the client.
0.000057

elb_status_code
response status code.
200

backend_status_code
Response status code of the instance to which the ELB sent the request.
200

received_bytes
Size of received request (bytes)
0

sent_bytes
Size of sent request (bytes)
29

request
request from a client
“GET http://www.example.com:80/HTTP/1.1”

User Agent perspective

How to investigate user agent?
As an example, the user agent for IE9 is described as follows.

Mozilla / 5.0 (compatible;MSIE 9.0; Windows NT 6.1; Trident/5.0)

Application name
It corresponds to the “Mozilla” part. It is used in the sense that it has the function of the type of browser or its application.

Application Version
In the “5.0” part after Mozilla, it indicates the version of the application.

Platform token
It corresponds to the “Windows NT 6.1” part. It will be the display about OS.

Version Token
It corresponds to the part of “MISE 9.0”.Displaying browser version.

Compatibility Flags
It corresponds to the “Compatible” part. It shows the compatibility with Internet Explore.

Rendering engine
It corresponds to the part of “Trident/5.0”. Shows software that causes the browser to display the requested content.

Internet Explore
ver.11

Mozilla / 5.0 (Windows NT 6.3; ARM; Trident / 7.0; Touch; MALNJS; rv: 11.0) like Gecko

ver.10

Mozilla / 5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW 64; Trident / 6.0)

Chrome

Mozilla / 5.0 (Windows NT 5.1) AppleWebKit / 535.11 (KHTML, like Gecko) Chrome / 17.0.963.79 Safari / 535.11

Firefox

Mozilla / 5.0 (Windows NT 6.1; rv: 11.0) Gecko / 20100101 Firefox / 11.0

Safari

Mozilla / 5.0 (Macintosh; U; Intel Mac OS X; en-jp) AppleWebKit / 523.12 (KHTML, like Gecko) Version / 3.0.4 Safari / 523.12

Android

Mozilla / 5.0 (Linux; Android 4.4.2; 302KC Build / 101.0.2c00) AppleWebKit / 537.36 (KHTML, like Gecko) Version / 4.0 Chrome / 30.0.0.0 Mobile Safari / 537.36 YJApp-ANDROID jp.co.yahoo.android. ybrowser / 1.7.5

なるほど、内容よく見ると、どのブラウザか一発でわかりますね。まあ、一般的にユーザーエージェントは偽装されるのであまり意味ないかもしれませんが。そういえば、IPって偽装できるんでしょうか??? Chrome Extensionで、Hotspot Shieldを使えば偽装できるようですが。。

ELB http 460

What is HTTP 460 on ELB
The load balancer received a request from a client, but the client closed the connection with the load balancer before the idle timeout expired.

Check if the client timeout period is longer than the load balancer idle timeout period. Before the client timeout period expires, make sure that target returns a response to the client, or if the client supports it, increase the client timeout period to match the load balancer idle timeout.

301 redirect and 302 redirect

The 301 redirect is “permanent redirect” and “permanent transfer”, while the 302 redirect is “temporary redirect” and “temporary transfer”.

Consider that a URL set to 301 redirect will not appear in the index. However, the 301 redirect takes over the information of the transfer source (old URL) to the transfer destination (new URL).

Amazon S3のAWS署名バーション2の廃止

S3の署名バージョン2が廃止になる。

– 以前の AWS リージョンの一部では、Amazon S3 で署名バージョン 4 と署名バージョン 2 がサポート。ただし、署名バージョン 2 は廃止され、署名バージョン 2 の最終サポートは 2019 年 6 月 24 日に終了
https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/dev/UsingAWSSDK.html#UsingAWSSDK-sig2-deprecation

2016年5月以前にリリースされた AWS SDK を使用する場合、次の表に示すように、署名バージョン 4 のリクエストが必要になることがある
AWS CLI

$ aws configure set default.s3.signature_version s3v4
$ aws configure set profile.your_profile_name.s3.signature_version s3v4

Java SDK

System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY, "true");
-Dcom.amazonaws.services.s3.enableV4

JavaScript SDK

var s3 = new AWS.S3({signatureVersion: 'v4'});

PHP SDK

									
$s3 = new S3Client(['signature' => 'v4']);

Python-Boto SDK

[s3] use-sigv4 = True

Ruby SDK

s3 = AWS::S3::Client.new(:s3_signature_version => :v4)
s3 = Aws::S3::Client.new(signature_version: 'v4')

.NET SDK

AWSConfigsS3.UseSignatureVersion4 = true;

つまり、AWS SDKを使っている場合は、バージョンを確認
– AWS SDK for Java v1 →Java 1.11.x あるいは v2 in Q4 2018 にアップグレード。
– AWS SDK for Java v2 ※アップグレード不要
– AWS SDK for .NET v1 →3.1.10 以降にアップグレード
– AWS SDK for .NET v2 →3.1.10 以降にアップグレード
– AWS SDK for .NET v3 ※アップグレード不要
– AWS SDK for JavaScript v1 →主要バージョン V3 in Q3 2019 にアップグレード
– AWS SDK for JavaScript v2 →2.68.0 以降にアップグレード
– AWS SDK for JavaScript v3 →主要バージョン V3 in Q3 2019 にアップグレード
– AWS SDK for PHP v1 →主要バージョン V3 にアップグレード
– AWS SDK for PHP v2 →主要バージョン V3 にアップグレード
– AWS SDK for PHP v3 ※アップグレード不要
– Boto2 →Boto2 v2.49.0 にアップグレード
– Boto3 →1.5.71 (Botocore)、1.4.6 (Boto3) にアップグレード
– AWS CLI →1.11.108 にアップグレード
– AWS CLI v2 ※アップグレード不要
– AWS SDK for Ruby v1 →Ruby V3 にアップグレード
– AWS SDK for Ruby v2 →Ruby V3 にアップグレード
– AWS SDK for Ruby v3 ※アップグレード不要
– Go ※アップグレード不要
– C++ ※アップグレード不要

pgrep httpd

pgrep
It is a command to search for process ID using a pattern that represents process name, user group, terminal name, etc. among running processes. You can use exetnded regular expression(10th) for patterns.

You can also use the pidof command to find the process ID from the command name.

[vagrant@localhost tests]$ pgrep httpd
1779
2082
2083
2084
2085
2086
2087
2088
2089

この数字はプロセスIDですな。

ls -t

ls -t: Sort and display in time stamp order.

[vagrant@localhost tests]$ touch index.php
[vagrant@localhost tests]$ ls -t
index.php backup beforeinstall.sh codedeploy
[vagrant@localhost tests]$ ls
backup beforeinstall.sh codedeploy index.php

なるほど~
[vagrant@localhost tests]$ ls -l | tail -n+2
drwxrwxr-x 3 vagrant vagrant 4096 3月 17 20:41 2019 backup
-rwxr-xr-x 1 vagrant vagrant 422 3月 17 20:41 2019 beforeinstall.sh
drwxr-xr-x 3 vagrant vagrant 4096 3月 17 11:04 2019 codedeploy
-rw-rw-r– 1 vagrant vagrant 0 3月 18 08:36 2019 index.php

If not specified, 10 lines from the last line will be displayed, but with the -n option, the specified number of lines will be output.

[vagrant@localhost tests]$ ls -t | tail -n+1
index.php
backup
beforeinstall.sh
codedeploy
[vagrant@localhost tests]$ ls -t | tail -n+4
codedeploy
[vagrant@localhost tests]$ ls -t | tail -n+3
beforeinstall.sh
codedeploy
[vagrant@localhost tests]$ ls -t | tail -n+2
backup
beforeinstall.sh
codedeploy

にゃるほどー

shell loop(for), function, +α

#!/bin/sh

for var in 0 1 2 3 4
do
	echo $var
done

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
0
1
2
3
4

{0..5}とも書ける。」

#!/bin/sh

for var in {0..5}
do
	echo $var
done

function

#!/bin/sh

MyFunction(){
	echo "display function"
}
MyParamFunc(){
	echo "parm1:$1 param2:$2"
}

MyFunction
MyParamFunc 5 4

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
display function
parm1:5 param2:4

with linux command

#!/bin/sh

index=1
for file in *.txt
do
	mv "$file" "mytxt${index}.txt"
	index=`expr $index + 1`
done

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh

すげええええええええええええええええええええええええ

shell while

#!/bin/sh

a=0
while [ $a -lt 5 ]
do
	echo $a
	a=`expr $a + 1`
done

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
0
1
2
3
4

‘と`の違いで手古摺った.

#!/bin/sh

a=0
until [ ! $a -lt 5 ]
do
	echo $a
	a=`expr $a + 1`
done